rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
17.67k stars 1.61k forks source link

Bypass/change Markdown parser #264

Open Rufflewind opened 7 years ago

Rufflewind commented 7 years ago

It would be nice if there was a way to disable or swap out the Markdown parser for an some alternative Markdown parser (e.g. Pandoc) or a different markup format like reStructuredText or asciiDoc, etc.

I’m aware that you can do this by writing a new Renderer, but that means duplicating all the code that implements HtmlHandlebars, yet all I need is to tweak a single line of code.

azerupi commented 7 years ago

I think this is a good idea, however, on the long term, we need to choose if we want to take HTML as input or have an intermediate format (like an AST?). The latter would require more work, but ultimately I feel like it will give us way more flexibility in the long run. @steveklabnik any thoughts?

I wouldn't mind having a quick-fix allowing you to do what you need in the mean time though. :)

Rufflewind commented 7 years ago

HTML as intermediate would work fine for HTML books, but I don’t know how well it works for more general documents. FWIW Pandoc uses JSON as an intermediate format for its AST.

steveklabnik commented 7 years ago

@steveklabnik any thoughts?

I personally am only interested in CommonMark Markdown; I don't think that mdBook should never have support, but am not likely to be involved with shipping it. 😄

boydkelly commented 12 months ago

It would be nice if there was a way to disable or swap out the Markdown parser for an some alternative Markdown parser (e.g. Pandoc) or a different markup format like reStructuredText or asciiDoc, etc.

I’m aware that you can do this by writing a new Renderer, but that means duplicating all the code that implements HtmlHandlebars, yet all I need is to tweak a single line of code.

I'm thinking this would be awesome as well. Of course it might take a hair more than one line of code. But if mdbook will take and publish html it shouldn't care what sends it the html. Swap out for asciidoctor.js would be a ++++!

(I also heard somewhere on the internet that there was a project to build a rust parser for asciidoc!)

SIGSTACKFAULT commented 8 months ago

Would love to be able to swap in RST then add custom directives.