Closed bessw closed 4 years ago
Thank you for your suggestion.
preNoteToMarkdownHtmlHook(note, markdown)
that is called before the markdown html of a note is generated
There now is a new release, could you please test it and report if it works for you?
The hook works great, I'll create a pull request if I get my script for on the fly LaTeX rendering running.
Great, thank you for testing!
@bessw Any update on the script? @pbek Why should I prefer the markdown hook for an (Latex) image instead of the more powerful html with the corresponding hook?
@r00tr4v3n can you please elaborate on your question.
You mention LaTeX math and mermaid explicitly in the docs of preNoteToMarkdownHtmlHook
.
But it only allows changes in the markdown file like replacing a $x^2$
to ![img](path)
. Why shouldn't be the noteToMarkdownHtmlHook
preferred where I can inject a
<img src="http://latex-gen.org/x^2">
for the equation?
Is there a way to change the html of the preview later on?
I think I was tinkering on two scripts where I tried to use it mainly to get better performance on big notes with LaTeX math:
noteToMarkdownHtmlHook
preNoteToMarkdownHtmlHook
returning an empty string and inserting the md-it html later in the noteToMarkdownHtmlHook
.But after some time I got frustrated by Qt's javascript engine not supporting any library I wanted to use and the preview not supporting any advanced html and thus the need to modify libraries I wanted to use and the need to generate images and saving them in tmp files to display anything except text.
In the end I turned to Electron / cordova, chained some libraries together that are around on the web and got an editor with LaTeX and mermaid working in no time compared to my tries to get this in QOwnNotes using the scripting engine. (since this is a huge project its vary WIP and many features that QOwnNotes has aren't jet or anywhere soon implemented)
In the end I turned to Electron / cordova, chained some libraries together that are around on the web and got an editor with LaTeX and mermaid working in no time compared to my tries to get this in QOwnNotes using the scripting engine. (since this is a huge project its vary WIP and many features that QOwnNotes has aren't jet or anywhere soon implemented)
So you build your own Electron based notes app with LaTex support?
I'm trying, but it's a long way.
A hook to be able to modify what is passed to the markdown to html converter could be useful.
I think about something like: