Confusing issue with rendering code blocks
#102
Closed
opened 4 years ago by leemeichin
·
2 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
I've been migrating a bunch of old Markdown files into Pollen Markup syntax. It's been a fairly uneventful process so far, which is great!
I'm seeing some unintuitive behaviour when trying to render a block of code, however. This behaves the same using a plain old
pre
tag, no syntax highlighting involved.Take this snippet, for example:
I'd expect the output to be a
pre
tag with no indentation, just this:For reasons I don't understand, I'm instead getting an extra 6 characters of indentation on the second line.
Inspecting the generated
txexpr
shows nothing untoward:The HTML when using
view source
is suspicious though:It's as if the overall indentation of the generated HTML is being pulled into the content of the
pre
tag, which I'd want to be leftmosted aligned due to the sensitivity of the whitespace. This happens without using any of the provided decoding functions, so I'm at a loss here. This happens pretty consistently for everypre
tag, no matter where it is in the document.(Example post/repo in question here: https://git.sr.ht/~mrlee/pollen-experiment/tree/master/item/posts/gettin-ziggy-with-it-pi-zero.poly.pm)
Any thoughts?
The file you linked to doesn’t contain any
pre
tags. Though the example below suggests the default behavior is correct.Oh, my mistake. I didn't commit that change 😅
I realise that I had indented
◊when/splice
in the default template, which then found its way into the rendered output (where the chlidren ofmain
maintained some level of indentation relative to the parent element):Removing this indentation solved the problem (and it was only the
when/splice
indentation that mattered). Basically just an edge-case that I've seen others solve by runningtidy
on the output, or similar.