chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

First line of markdown not converting properly #127

Closed slashinfty closed 2 years ago

slashinfty commented 2 years ago

I can't for the life of me figure out why the first line of my markdown files aren't converting properly. I've attached one markdown file, and the HTML output is here: https://mattbraddock.com/geometry/slides/101__construction_ba/index.html

1.01 - Construction Basics.md

georgestagg commented 2 years ago

Thanks, this looks like a bug, probably related to finding YAML headers in markdown files. I'll see what I can do about tracking down the exact problem in the logic.

For the moment, using the following alternative syntax might work around the problem:

Objective(s)
------------

* Create diagrams using a straightedge
* Use a compass to construct a circle
slashinfty commented 2 years ago

I'm going to close this issue, because I don't think there's an actual problem.

I copied and pasted text from StackEdit into a text editor, and apparently there's an invisible character or something at the start, because if I delete and retype the first line in my text editor, then run the compilation, it works just fine.

slashinfty commented 2 years ago

Okay, I lied. It worked exactly once (retyping the first line), but now it is not working.

Edit: the alternative method for headers (==== and ----) works, though it's not the most elegant solution unless all headers are converted to that.

georgestagg commented 2 years ago

I think I've got it! The strange character sounds like a Byte order mark, inserted as the first character in the file by some text editors. The markdown renderer is seeing that mark at the start of the line, and so the first line is no longer valid markdown for inserting a heading.

I've pushed a commit changing the code to read input files with encoding utf-8-sig rather than utf-8. That should automatically remove the BOM from the content, if it exists. As far as I can tell, that seems to fix the problem.

slashinfty commented 2 years ago

I tried to export a MD file from StackEdit and upload it directly here, but it didn't convert appropriately. Is this specific to the public content builder?

1.03 - Constructing Bisectors.md

georgestagg commented 2 years ago

Sorry, my fault - I forgot to update the docker image powering the public content builder. Try again now?

Also be sure to click the "Show/hide settings" button and drop down to change the item type to "Slides". It's worth adding a reasonable title for the item there too.

I should probably make the default some kind of automatic mode that falls back to a working default setting for markdown files...

slashinfty commented 2 years ago

I did change the item type to "Slides." That being said, it looks like updating the docker image fixed it.

Thank you very much for your work on this project!