Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org-mode support? #1183

Closed
karlicoss opened this issue Apr 7, 2020 · 10 comments
Closed

org-mode support? #1183

karlicoss opened this issue Apr 7, 2020 · 10 comments

Comments

@karlicoss
Copy link

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.

@tendant
Copy link

tendant commented Apr 13, 2020

@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.

@karlicoss
Copy link
Author

@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).

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented May 4, 2020

@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:

  1. reads a blob of JSON from stdin
  2. scans through the book to find any chapters who's name ends in .org
  3. convert the contents from org-mode format to markdown
  4. print the result as another blob of JSON

This 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.

@karlicoss
Copy link
Author

@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.

@richardwesthaver
Copy link

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

@chipsenkbeil
Copy link

@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.

@Michael-F-Bryan
Copy link
Contributor

@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
Copy link

chipsenkbeil commented Jan 2, 2021

@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.

@txtyash
Copy link

txtyash commented Sep 6, 2022

Just add support for org files. Please!

@ehuss
Copy link
Contributor

ehuss commented Jul 17, 2023

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.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants