Investigate a possibility to generate markdown preview on FE instead of BE
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
At the moment, markdown preview is generated on the server that means live-preview should constantly send requests to the BE to get the updated preview. This might unnecessarily load our infrastructure. This issue suggests moving that computation to FE instead.
Technical ground
There are several JS libraries doing markdown to HTML conversion. Some options:
- markdown-it
- remarkable
- etc.
Computations should be properly debounced. Maybe we should explore the WebWorker path for this purpose to unload the main thread.
UPDATE 04 Feb, 2022:
After looking into the Unist ecosystem, I would suggest the following plan for this issue:
- Use Remark for parsing markdown content and convert it into AST (mdast)
- Pass on mdast to Rehype. This will convert the tree to hast
- Get HTML string out of hast
To account for gitlab flavored markup, we should either
- Review functionality of
remark-gfm
, or - Write our own plugin based on
remark-gfm
and supporting all the functionality gitlab flavored markup provides
Edited by 🤖 GitLab Bot 🤖