Created
September 11, 2014 04:15
-
-
Save teppeis/715771a870b33b4dcc39 to your computer and use it in GitHub Desktop.
Convert Markdown to Confluence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Convert Markdown to Confluence | |
# | |
# Supported syntax | |
# * heading (1-6) | |
# * blockquote (only single line ".bq") | |
# * code block fence (```) | |
# * inline code (`foo`) | |
# * link ([name](url)) | |
cat - | sed \ | |
-e 's/^# /h1. /g' \ | |
-e 's/^## /h2. /g' \ | |
-e 's/^### /h3. /g' \ | |
-e 's/^#### /h4. /g' \ | |
-e 's/^##### /h5. /g' \ | |
-e 's/^###### /h6. /g' \ | |
-e 's/^> /bq. /g' \ | |
-e 's/^```\(.\+\)/{code:language=\1}/g' \ | |
-e 's/^```$/{code}/g' \ | |
-e 's/\s\?`\([^`]\+\)`\s\?/ {{\1}} /g' \ | |
-e 's/\[\([^]]*\)\](\([^)]*\))/[\1|\2]/g' \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment