diff options
author | François-Xavier Carton <fx.carton91@gmail.com> | 2020-11-22 15:15:52 +0100 |
---|---|---|
committer | François-Xavier Carton <fx.carton91@gmail.com> | 2020-11-22 15:15:52 +0100 |
commit | fc1425c7016903b620220a21d761d9198bc874d8 (patch) | |
tree | e7d91ee258980e990dc0df723ab8ec4be15ead0c /blogit | |
parent | 2970a04be8d3611c855d22edc7bee3bcfa6eb823 (diff) |
Allow escaping $ and fix &
- $ can now be escaped with \$ to prevent variable substitution
- this is not needed in code blocks (``` ... ```), variables are never
expanded there
- & is properly escaped so that a & in markdown will result in a & in
html, as one would expect
Diffstat (limited to 'blogit')
-rwxr-xr-x | blogit | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -142,8 +142,10 @@ blog/%.html: articles/% $(addprefix templates/,$(addsuffix .html,header article_ -e '/^;/d' \ -e 's/</\</g' \ -e 's/>/\>/g' \ + -e 's/&/\&/g' \ -e '/^```$$/{s,.*,,;x;p;/^<\/code>/d;s,.*,<pre><code>,;bT}' \ - -e 'x;/<\/code>/{x;$$G;p;d};x' \ + -e 'x;/<\/code>/{x;s,\$$,\$,g;$$G;p;d};x' \ + -e 's,\\\$$,\$,g' \ -e '/^####/{s,^####,<h4>,;s,$$,</h4>,;H;s,.*,,;x;p;d}' \ -e '/^###/{s,^###,<h3>,;s,$$,</h3>,;H;s,.*,,;x;p;d}' \ -e '/^##/{s,^##,<h2>,;s,$$,</h2>,;H;s,.*,,;x;p;d}' \ |