Skip to content

Instantly share code, notes, and snippets.

@hacolab
Created December 15, 2019 08:29
Show Gist options
  • Save hacolab/77de3272f6ab9fdcf145dd079fe04da4 to your computer and use it in GitHub Desktop.
Save hacolab/77de3272f6ab9fdcf145dd079fe04da4 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Newline mark of hatena blog
NEWLINE=" "
# Append newline mark to continue line
sed -e 's/$/'"${NEWLINE}"'/' \
-e 's/'"${NEWLINE}${NEWLINE}"'$/'"${NEWLINE}"'/' \
-e "s/^${NEWLINE}$//" \
-e '/^ *[#>|]\{1,\}/s/'"${NEWLINE}"'$//' \
-e '/^ *- /s/'"${NEWLINE}"'$//' \
-e '/^ *[0-9]\{1,\}\. /s/'"${NEWLINE}"'$//' \
-e '/^ *\[.*\] *$/s/'"${NEWLINE}"'$//' \
-e '/^```/,/^```/s/'"${NEWLINE}"'$//' \
| tr '\n' '>' \
| sed 's/'"${NEWLINE}"'>>/>>/g' \
| tr '>' '\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment