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

pikchr integration? #152

Open
ethanmdavidson opened this issue Jul 18, 2022 · 1 comment
Open

pikchr integration? #152

ethanmdavidson opened this issue Jul 18, 2022 · 1 comment
Labels

Comments

@ethanmdavidson
Copy link

Hi, I'm interested in contributing a Pikchr integration. Pikchr is written in C, so it looks like I'll need to call C from Python (pikchr integration docs). I don't work much with either python or C, but based on 10 minutes of research it looks like the easiest way to call C from Python is to use something like SWIG. This looks fairly easy, but I think it will involve changing the build process and I'm not sure about the implications in other areas (especially publishing to PyPi).

Please let me know:

  1. if the pikchr integration seems feasible and desirable
  2. is this the easiest way to accomplish it, or is there a better way?
@pbodnar
Copy link
Collaborator

pbodnar commented Jul 30, 2022

Hi @ethanmdavidson, thanks for sharing your idea. I don't know how the mistletoe community, but I think it would be cool to have some "UML-like" diagrams support.

I have done some quick research, and it looks like there are various alternatives (each offering a different approach and set of features):

a) Pikchr - the easiest integration seems to be via calling a local OS-dependent executable which can be built from Pikchr's C source code (example: a filter for Pandoc which calls Pikchr).
b) PlantUML - can be integrated by calling its Java jar, or by calling a (public) PlantUML server (see PlantUML Extension for Python-Markdown).
c) Mermaid - probably the most lightweight integration via including its JavaScript in the resulting HTML page (an output example). Con: this would work just for HTML renderers.

So, when thinking out a solution, it would be good to think about how to make it as reusable (general) as possible. But of course, that will take some time, so maybe having something less universal, yet working, would also be great...

Back to Pikchr :), I think the best non-intrusive & simple approach would be calling it from Python as an external command, similar to the Pandoc example linked at point (a). From the many possible approaches, I would probably choose Python's subprocess.run() to implement the call, as described for example here. (It looks like mistletoe doesn't call any external command / executable yet.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants