devbean / obsidian-wordpress

An obsidian plugin for publishing docs to WordPress.
https://devbean.github.io/obsidian-wordpress
Apache License 2.0
158 stars 22 forks source link

feature request: Import Code-Snippes and MermaidJS Pictures #62

Open fugohan opened 11 months ago

fugohan commented 11 months ago

Hey, I saw that this plugin is converting my code snippets and MermaidJS pictures into text. Is there any possibility to display them correctly in WordPress?

craig-miller commented 9 months ago

I'm also using mermaid. I have two possible solutions:

  1. Integrate with WP Mermaid: On WordPress I've installed the WP Mermaid Plugin by Terry Lin. It renders Mermaid server side if it finds a block containing mermaid. One option would be for this plugin to work with "WP Mermaid" by modifying the content as it posts such that
```mermaid
sequenceDiagram
Alice->Bob: Hello Bob, how are you?
becomes

[mermaid] sequenceDiagram Alice->Bob: Hello Bob, how are you? [/mermaid]



2. Second option:  Doesn't require a server side dependency.
 Render the mermaid diagram client side into an image, upload the image, and replace the mermaid markdown with the generated image.  This is ideal from an Obsidian user perspective as the diagram will be rendered with the same style as displayed in Obsidian.