39 lines
873 B
Sed
39 lines
873 B
Sed
|
|
# Add spaces to == headers such as "=header="
|
|
s/^\(=\+\)\([^=]*\)\(=\+\)$/\1 \2 \3/
|
|
|
|
# Replace comments
|
|
s/# \(.*\)$/* \1/g
|
|
|
|
# Replace == headers with # headers
|
|
s/^= \(.*\) =$/# \1/g
|
|
s/^== \(.*\) ==$/## \1/g
|
|
s/^=== \(.*\) ===$/### \1/g
|
|
s/^==== \(.*\) ====$/#### \1/g
|
|
s/^===== \(.*\) =====$/##### \1/g
|
|
s/^====== \(.*\) ======$/###### \1/g
|
|
|
|
# Replace code tags
|
|
s/{{{class="brush: *\([^"]*\)"/\`\`\`\1/g
|
|
s/{{{class="\([^"]*\)"/\`\`\`\1/g
|
|
s/{{{/\`\`\`/g
|
|
s/}}}/\`\`\`/g
|
|
|
|
# Replace * bullets with - bullets
|
|
s/^\(\s*\)\*/\1-/g
|
|
|
|
# Replace partially-finished checklist items with unfinished checklist items
|
|
s/^\(\s*\)- \(\[[.oO]\]\)/\1- [ ]/g
|
|
|
|
# Replace URLs
|
|
s/\[\[\(.*\)|\(.*\)\]\]/\[\2\](\1)/g
|
|
s/\[\[\([^]]\{1,\}\)\]\]/[\1](\1.md)/g
|
|
|
|
# Replace comments
|
|
s/%% \(.*\)/<!-- \1 -->/g
|
|
|
|
# Replace TOC, Title, and draft status
|
|
/%toc.*/d
|
|
s/%title \(.*\)/# \1/g
|
|
s/%nohtml/- status: draft/g
|