boozook / mdbook-svgbob

SvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
Mozilla Public License 2.0
76 stars 8 forks source link

Use `mdbook::utils::new_cmark_parser` to preserve tables #17

Closed mgeisler closed 1 year ago

mgeisler commented 1 year ago

Before, we would ignore the Markdown settings from mdBook and parse the content with default settings. This meant that we did not support Markdown tables, which are an extension to regular Markdown. The result was that tables were mangled after the preprocessor had run. They looked like this:

image

We now use the mdBook utility function to construct the Markdown parser, thus getting consistent results. This makes tables survive the parsing.

The PR also has a commit which restores the preprocessing functionality, it was accidentally lost in the refactor in https://github.com/boozook/mdbook-svgbob/commit/900cd776bc0bc2dd52587720e29f6acec61d4e66.

boozook commented 1 year ago

@mgeisler, All looks perfect, but formatting. Please just accept my PR firstly.

mgeisler commented 1 year ago

@mgeisler, All looks perfect, but formatting. Please just accept my PR firstly.

Thanks, happy to merge that of course!

About the formatting: I'm pretty sure my editor ran rustfmt with the settings from the .rustfmt.toml file in the repository. I see that because it used TABs instead of spaces for the indentation. Are you formatting things further outside of running rustfmt?

mgeisler commented 1 year ago

Ah, I see now: the rustfmt run failed.

The problem was that I had a stable compiler as my default. When I switch to nightly, the code looks like your PR. Mystery solved :-D