Closed karlicoss closed 1 year ago
@karlicoss Have you tried https://ox-hugo.scripter.co? It can convert org file to markdown. You might need to clean up exported markdown file to make it work with mdBook.
@tendant thanks for the link! Yep, have seen it, but haven't found it much different from the standard org-mode exporter into markdown (also requires a bit of cleanup).
@karlicoss. instead of using your own build scripts or other hackiness, have you looked into making your own preprocessor?
What you'd need to do is create some program/script which:
name
ends in .org
contents
from org-mode format to markdownThis is nice because it'll integrate with the mdbook
build process, so everything should Just Work.
I'd be happy to mentor you through the process and review code 🙂 I've created a couple mdbook plugins in my time and also had a hand in designing the whole plugin architecture.
@Michael-F-Bryan oh, that looks very neat, I'll check this out! And big thanks for the mentoring offer -- I'll let you know if I have any issues and will send you the final version when I prototype something.
just wanted to put in the +1 for org-mode support :) @karlicoss I appreciate u sharing your hack at it - my current setup for web-sharing stuff uses something similar with a Makefile, calling ox-hugo on the files and building the web content with zola (static site generator).
I'm still learning about mdbook but I was thinking of implementing a markdown handler with this crate: https://github.com/PoiScript/orgize which provides an org syntax parser that implements serde - the source code has some useful tidbits if it's of any use.
Cheers, Richard
@Michael-F-Bryan, I wouldn't mind taking a crack a preprocessor, but for vimwiki. I spent some time writing vimwiki-rs, but need to add the ability to output back into markdown. Of the plugins you've written, which would you recommend as the best starting point to model a new preprocessor?
Once I get vimwiki done, I could do the same for orgize unless @richardwesthaver wants to take a crack at it instead.
@chipsenkbeil the best place to start is the [For Developers]https://rust-lang.github.io/mdBook/for_developers/index.html) chapter in the User Guide. That shows a how you can hook up custom preprocessors and backends.
There is also a nop-preprocessor
example which goes through the preprocessor machinery then returns the same book unchanged.
You just need to write code which returns a mdbook::book::Book
with your desired changes. In this case, converting vimwiki syntax to markdown so it can be rendered by the HTML renderer.
@chipsenkbeil the best place to start is the [For Developers]https://rust-lang.github.io/mdBook/for_developers/index.html) chapter in the User Guide. That shows a how you can hook up custom preprocessors and backends.
There is also a
nop-preprocessor
example which goes through the preprocessor machinery then returns the same book unchanged.You just need to write code which returns a
mdbook::book::Book
with your desired changes. In this case, converting vimwiki syntax to markdown so it can be rendered by the HTML renderer.
Great! That's similar to what I'm looking to support for adding vimwiki support to cobalt.rs, so I can tackle these both at the same time.
Just add support for org files. Please!
I'm going to close since it is unlikely that direct support for different input formats will be added at this time. It seems like it shouldn't be too difficult to create an org-mode preprocessor. If someone creates one, be sure to add it to the third party plugins list.
Was wondering, how hard would it be to, in theory, support different input formats, like org-mode?
I've got a personal wiki in org-mode and I'm using mdbook + some hacky scripts to convert it into markdown and publish as mdbook.
While it kind of works, it's a bit overcomplicated and flaky, so I've been wondering that perhaps it's worth having first-class support of org-mode.
Main things I like about mdbook are the search index, incremental search and the navigation sidebar. I could, of course, just reimplement it from scratch. But in case mdbook is already generic enough to relatively easily support alternative input formats, I'd be happy to contribute to it instead.