preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

code blocks with backslashes #484

Closed neilhwatson closed 6 years ago

neilhwatson commented 8 years ago

Markdown, see the virt-install script: https://github.com/neilhwatson/www.watson-wilson.ca/blob/master/blog/2014/10/30/changes-in-virt-install-and-kickstart-in-rhel7/index.markdown

And what Statocles renders it to: https://github.com/neilhwatson/www.watson-wilson.ca/blob/master/.statocles/build/blog/2014/10/30/changes-in-virt-install-and-kickstart-in-rhel7/index.html#L93-L96

The block is not preserved

preaction commented 8 years ago

It does look like Text::Markdown is supposed to allow backslashes in code, by escaping them from any other behavior: https://github.com/bobtfish/text-markdown/blob/master/lib/Text/Markdown.pm#L1278 So either there's a problem there in Text::Markdown, or Statocles is doing something before it gets to Text::Markdown.

I did notice that if you double the backslash, it works. This could get you going while we track the problem down.

I'm starting to really want to write my own Markdown parser...

neilhwatson commented 8 years ago

I"m sure I tried double back slashes already and it failed. A md2html < file.md testing program would be really handy.

preaction commented 8 years ago

That's basically just:

perl -MText::Markdown -E'say Text::Markdown->new->markdown( join "", <> )' <filename>

Using that, it seems a single slash gets preserved, so perhaps it's Mojo::Template that's doing this...

preaction commented 8 years ago

I had a though about the ad-hoc rendering problem: Would it be useful to have a statocles render command? Then one could give a markdown file and get the resulting HTML passed through all of the right things. Options could include specifying which --template <template>, --layout <template>, and --app <name>. Would this help in figuring out rendering issues?

neilhwatson commented 6 years ago

Double '\\' seems to work now.