arnm/ob-mermaid

Option to use online service instead of a local cli tool

Opened this issue · 0 comments

That is a feature request to consider. Whether it is a good pratice or not, is an open discussion.

Use case: emacs runs as a service in a docker container to convert a tree of org files to a tree of html files.

And now it is a dilemma how to render mermaid source blocks.

  1. Install mermaid cli into an emacs docker image, which in its turn depends on NodeJS and so on... Image bloats and goes against docker philosophy, which suggests a separate container per component.
  2. Use an external mermaid service, either as a separate docker container or publicly available https://mermaid.ink/. This may, however, be against emacs/org/org-babel philosophy, if there is any about this matter, I'm not sure, hence I'm offering an open discussion.

To solve my problem, I will do my own custom ob-mermaid which will encode the source block by first replacing line ends and tabs with \n and \t and so on respectively, then make JSON like {"code":"...content..."}, then Base64 encode the JSON, and send as a web request https://mermaid.ink/svg/<encoded_content> or https://mermaid.ink/img/<encoded_content>, depending on which format is preferred, SVG or PNG. The question is, am I the only one who finds this functionality useful? If that all makes sense to others, the feature described might become a useful part of this module.

Thanks