Intelligent Markdown Rendering
Solvedlenainjaune Posted messages 726 Registration date Status Contributeur Last intervention -
Hello everyone,
I use markdown (handy, lightweight) on large documents and I'm looking for a solution to synchronize the rendering with modifications.
I was previously using remarkable which suited me but lacked ergonomics. I am currently testing the editor geany with the markdown module (note: geany v2.0+ and source compilation) which is better in terms of ergonomics.
Both tools have in common that the rendering does not follow the input. It is systematically re-generated (in remarkable upon saving and in geany upon modification) => the display scrolls to the beginning of the document and does not show the current modification, which is therefore not practical.
Do you have a solution?
I can clarify if it's not clear ...
With brotherhood,
lnj
I have questions for all your answers. (Woody Allen)
Knowledge and ideas belong to everyone (noosphere)!
2 réponses
Hello,
There are many real-time markdown editors. Search for "markdown realtime" with your favorite search engine. Here are some possible solutions:
- Realtime Markdown
- Markdown Editor & Previewer
- Couple your favorite text editor (e.g., vim) with a tool capable of rendering a pdf (e.g., okular)
Good luck
As you requested, a little feedback on a tool that I find interesting:
markdown-preview (lightweight client); sets up a local web server and syncs with the file once saved from the editor by updating only the displayed part
Prerequisites: requires npm (Node.js - open-source runtime environment for the JavaScript language)
Install (as root):
root@host:~# npm install -g @mryhryki/markdown-preview
Set up synchronization on a file (as user):
user@host:~/folder/md$ markdown-preview --file install_glpi.md --template default-dark --port 34567 --log-level info --no-opener Root Directory : /home/user/folder/md Default File : file.md Extensions : md, markdown Template File : /home/user/.npm/_npx/91ea61767fc723b7/node_modules/@mryhryki/markdown-preview/template/default.html Preview URL : http://localhost:34567 [2024-04-01T19:54:55.972] [INFO] default - File update: /home/user/folder/md/file.md [2024-04-01T19:55:13.291] [INFO] default - File update: /home/user/folder/md/file.md ... # => updated on each save
Note: absolute paths cannot be used here, so relative paths to the current folder must be used
=> accessible from a browser at the address: http://localhost:34567
Pros: synchronized previews with editing (however, slight latency), separate visualization from the editor, handling of mermaid (diagrams, charts, etc.), chosen editor and provides all necessary tools, navigation possible from preview
Cons: no support for KaTeX (mathematical formulas in TeX), slight synchronization latency
Note: for KaTeX I think it wouldn't be complicated to integrate since mermaid is!
There you go :D!
I have questions for all of your answers. (Woody Allen)
Knowledge and ideas belong to everyone (noosphere)!
Hello,
First of all, a big thank you for your feedback.
I'm taking this opportunity to point out another solution, which may not necessarily concern you.
- For my part, doing a lot of Python at work, I use the markdown preview in jupyterlab (to use it, just right-click on the .md file).
- The markdown rendering is regenerated upon evaluating the cell (shift+enter or ctrl+enter).
- Another strong point, jupyterlab now offers (like jupyter notebook in the past) the ability to render a notebook in RISE, which is a kind of "PowerPoint-style" presentation, but generated in JavaScript (which allows it to be integrated into a website). The advantage is that you write your slides in markdown (formatting, mathematical formulas, ...) and you also have, as in a regular notebook, the ability to include code cells.
- The presentation rendering is regenerated on demand.
- You can check a box to render it on every notebook save.
Best regards
Hello mamiemando :D
Great! I didn't think that existed.
I particularly like the idea of coupling the editor with another tool. That was the idea I had in mind and I was imagining it with these constraints:
- lightweight tool
- production of HTML (lighter than PDF production) from MD
- but above all, that the update is smooth and that it keeps the line currently at the beginning of the display. I don't know if I'm being clear...
It's up to you to test the different doors that open to you and choose the one that suits you best :-) I leave it to you to explore, but don't hesitate to give feedback when the time comes. See you soon and take care!