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/sed -nf | |
# Change files html to markdown | |
# Author: Igor Andrade <igor@igorlnx.com> | |
# version: 0.1 | |
# execute com $ sed -f changehtml.sed file.html > file.md | |
# remove o <\h1> até o 6 | |
s/<\/\(h1\|h2\|h3\|h4\|h5\|h6\)>//g | |
# grupo que altera os h's por markdown desejado | |
s/<h1>/# /g | |
s/<h2>/## /g | |
s/<h3>/### /g | |
s/<h4>/#### /g | |
s/<h5>/##### /g | |
s/<h6>/###### /g | |
# trocar o <p> por \n e <\p> por nada | |
s/<p>/\n\n/g | |
s/<\/p>//g | |
# negrito altera | |
s/<strong>\|<\/strong>\|<b>\|<\/b>/**/g | |
# troca o hr pelo *** | |
s/<hr>/***/g | |
# troca o ul e /ul e /li | |
s/<ul>\|<\/ul>\|<\/li>//g | |
# trocar o li por + | |
s/.*<li>/+ /g | |
# italico | |
s/<i>\|<\/i>/*/g | |
# links a href usando retrovisores | |
s/<a.*\"\(.*\)\">\(.*\)</[\2](\1)/g | |
s/\/a>//g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment