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

extending export-block to support more backends #101

Open
ispringle opened this issue Feb 14, 2024 · 2 comments
Open

extending export-block to support more backends #101

ispringle opened this issue Feb 14, 2024 · 2 comments

Comments

@ispringle
Copy link
Contributor

Currently the export-block supports only HTML. It'd be great if this was extensible so additional backends could be provided and handled. For example, I'd like to be able to use an export block to generate graphs with MermaidJS. It'd be great if we could extend this with an object of other backends and then a function that would return the proper ast object.

@rasendubi
Copy link
Owner

Hey. uniorg-rehype is specifically an org-to-html converter (rehype/hast is an AST representation of HTML), so I'm not sure what you mean by supporting more backends. There are multiple ways to plug-in more functionality like mermaidjs though.

First, it's possible to add more unified plugins that would transform AST before (or after) uniorg-rehype. So, for example one could add a plugin that transforms #+begin_src mermaid or #+begin_mermaid ("special block") blocks to a proper export-block (which would then get exported by uniorg-rehype).

Second, uniorg-rehype accepts a handlers option, which allows to override how certain blocks are exported. So you can override how export-block is handled

Hope this helps

@venikx
Copy link
Contributor

venikx commented Apr 11, 2024

Currently the export-block supports only HTML. It'd be great if this was extensible so additional backends could be provided and handled. For example, I'd like to be able to use an export block to generate graphs with MermaidJS. It'd be great if we could extend this with an object of other backends and then a function that would return the proper ast object.

Do you export these mermaids with org-export?
If you just want your pages to convert mermaid code to diagrams. You should be able to embed the mermaid.js script on your page, and then run mermaid.initialize() which will transform all mermaid code to diagrams.

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

3 participants