Skip to content

Improvement suggestion: replace showdown with smaller, newer library #21972

@sgomes

Description

@sgomes

Is your feature request related to a problem? Please describe.
showdown is a relatively large library (74KB, 24KB gzipped), that appears to no longer be in development (last activity in the repo/npm dates to early November last year).

Here is a visual representation of how much space it takes up in the blocks chunk:

image

That's more than all of the actual Gutenberg code for the same chunk.

Describe the solution you'd like
Replacing with a smaller and actively maintained library would work towards making the blocks chunk smaller.

My suggestion would be marked, which has several benefits:

  • It's only 28KB (9KB gzipped), which is significantly smaller than showdown
  • It's actively supported and strongly preferred by the community
  • It's significantly faster at runtime than showdown too, at around 6x the speed

Describe alternatives you've considered
The obvious alternative is to keep using the same library, but make the import smaller somehow. This was partially achieved in #21862, by upgrading to the latest version of showdown (which happened to be smaller).

Beyond that, the only option is to rely on tree-shaking to reduce the amount of the library that's being pulled in, by sticking to only what's necessary for our usage. Unfortunately, this is not possible with showdown, as it was coded as a monolithic single export that we have no choice but to import in its entirety. I created an issue for an architecture revamp in the library repo, but have obtained no response yet, though at time of writing it has only been a couple of days.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions