Skip to content

Instantly share code, notes, and snippets.

@sangwook
Created May 7, 2014 01:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sangwook/4152ed044293df56a42b to your computer and use it in GitHub Desktop.
Save sangwook/4152ed044293df56a42b to your computer and use it in GitHub Desktop.
vim 정규표현식으로 Markdown 을 Confluence wiki markup 으로 변환하기
" vim 정규표현식으로 Markdown 을 Confluence wiki markup 으로 변환하기
function! MarkdownToWiki()
execute '%s%^- %* %Ig'
execute '%s%^\t- %\t** %Ig'
execute '%s%^\t\t- %\t\t*** %Ig'
execute '%s%^\t\t\t- %\t\t\t**** %Ig'
execute '%s%^\t\t\t\t- %\t\t\t\t***** %Ig'
execute '%s%^\t\t\t\t\t- %\t\t\t\t\t****** %Ig'
execute '%s%^\t\t\t\t\t\t- %\t\t\t\t\t\t******* %Ig'
execute '%s%^# %h1. %Ig'
execute '%s%^## %h2. %Ig'
execute '%s%^### %h3. %Ig'
execute '%s%^#### %h4. %Ig'
execute '%s%^##### %h5. %Ig'
execute '%s%^###### %h6. %Ig'
" replace [title](url) with [title|url]
execute '%s%\v\[([^]]+)\]\(([^)]+)\)%[\1|\2]%Ig'
" https://confluence.atlassian.com/display/DOC/Confluence+Wiki+Markup#ConfluenceWikiMarkup-images
execute '%s%\v\<img src\=\"([^"]+)\"[^>]*\>%!\1!%Ig'
endfunction
command! MarkdownToWiki call MarkdownToWiki()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment