Investigate a possibility to generate markdown preview on FE instead of BE
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=280796) </details> <!--IssueSummary end--> 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](https://github.com/markdown-it/markdown-it) - [remarkable](https://github.com/jonschlinkert/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](https://github.com/syntax-tree/unist), I would suggest the following plan for this issue: - Use [Remark](https://github.com/remarkjs) for parsing markdown content and convert it into AST ([mdast](https://github.com/syntax-tree/mdast)) - Pass on mdast to [Rehype](https://github.com/rehypejs/rehype). This will convert the tree to [hast](https://github.com/syntax-tree/hast) - Get HTML string out of hast To account for gitlab flavored markup, we should either - Review functionality of [`remark-gfm`](https://github.com/remarkjs/remark-gfm), or - Write our own plugin based on `remark-gfm` and supporting all the functionality gitlab flavored markup provides
issue