From 0edc18c28ae23dd6e5af18bbcf8725848f7b7963 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 9 Jul 2021 23:52:26 -0400 Subject: [PATCH] md module --- README.md | 2 +- modules/md | 35 +++++++++++++++++++++++++++++++++++ modules/md-test | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100755 modules/md create mode 100644 modules/md-test diff --git a/README.md b/README.md index b5b2266..aaa54ad 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Pinopress +# pinopress **pinopress** is a modular makefile based static blog generator. that means you run the build script once and every page is generated beforehand. diff --git a/modules/md b/modules/md new file mode 100755 index 0000000..b2bc038 --- /dev/null +++ b/modules/md @@ -0,0 +1,35 @@ +#!/bin/sed -Ef + +## markdown to html module for pinopress +## based off https://github.com/stamby/md-to-html +# input $1 - filepath to html file + +# special html characters +s/\&/\&\;/g +s//\>\;/g + +# inline styles +s/(^|[^\\\*])\*{3}([^\*]+)\*{3}([^\*]|$)/\1\2<\/em><\/strong>\3/g +s/(^|[^\\_])_{3}([^_]+)_{3}([^_]|$)/\1\2<\/em><\/strong>\3/g +s/(^|[^\\\*])\*{2}([^\*]+)\*{2}([^\*]|$)/\1\2<\/strong>\3/g +s/(^|[^\\_])_{2}([^\_]+)_{2}([^_]|$)/\1\2<\/strong>\3/g +s/(^|[^\\\*])\*([^\*]+)\*([^\*]|$)/\1\2<\/em>\3/g +s/(^|[^\\_])_([^_]+)_([^_]|$)/\1\2<\/em>\3/g +s/(^|[^\\`])`([^`]+)`([^`]|$)/\1\2<\/code>\3/g + +# img +s/!\[(.*)\]\((.*)\)/\1/g + +# links +s/\[(.*)\]\((.*)\)/\2<\/a>/g +s/\[(.*)\]/\1<\/a>/g + +# headers +s/^#{4} (.*)/

\1<\/h4>/ +s/^#{3} (.*)/

\1<\/h3>/ +s/^#{2} (.*)/

\1<\/h2>/ +s/^#} (.*)/

\1<\/h1>/ + +# html style comments + diff --git a/modules/md-test b/modules/md-test new file mode 100644 index 0000000..bad1c65 --- /dev/null +++ b/modules/md-test @@ -0,0 +1,33 @@ +& > < + +#### +#### hello + +[https://danieliu.xyz] +[https://danieliu.xyz](my site) +[] +[]() + +![random image](https://imagehostingsite) + +*emphased text* +_emphased text_ +** +\*literal astericks\* + +**bold text** +__bold text__ +**** +\*\*literal bold\*\* + +***bold italic text*** +___bold italic text___ +****** +\*\*\*literal bold italic*\*\* + +\***should be strong**\* +\*\**should be emph*\*\* + +`inline code` +`` +\`escaped backtick\` -- 2.20.1