Skip to content

Remove markdown-it library from js bundle

Enrique Alcántara requested to merge remove-markdown-it-from-builds into master

What does this MR do and why?

We have a feature that allows copying HTML as Markdown in issue descriptions, MR descriptions, comments, etc.. You can see the implementation in copy_as_gfm.js. This feature relies on a library called prosemirror-markdown that allows converting Markdown to HTML and Vice-versa.

For the Markdown to HTML conversion, prosemirror-markdown relies on the markdown-it Markdown parser. However, we don’t perform Markdown to HTML conversion on the client yet. Therefore, we can remove markdown-it from the JS bundle by importing the parts of prosemirror-markdown that we are interested in.

How many bytes does markdown-it contribute to bundle size?

This MR removes 14kbs of gzipped content from this bundle. It’s not a lot but every little byte counts!

Screen_Shot_2022-02-03_at_3.36.15_PM

Screenshots or screen recordings

This MR doesn’t introduce user-facing changes.

How to set up and validate locally

  1. Open any resource in the GitLab application that displays Markdown rendered as HTML. For example, an issue, an MR, or a comment.
  2. Copy the content of that resource.
  3. Paste it in a textarea. The clipboard should contain Markdown that is equivalent to the content you copied.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Enrique Alcántara

Merge request reports

Loading