Release Candidate: Marp Core v5 🌈 #625
yhatt
announced in
Announcements
Replies: 1 comment
|
For theme authors, I created the skill for AI coding agent to migrate your theme to support Marp Core v5. 🤖 Download ZIP and extract to your skill directory, or run in your project: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm thrilled to announce that Marp Core has shipped the release candidate version v5.0.0!
Ahead of future stable release, let me introduce new features and breaking changes you should be aware of.
Important
v5 is not a stable release yet, and following features are NOT YET AVAILABLE in Marp CLI and Marp for VS Code. If you want to test v5 features in Marp CLI, please read Prepare for v5.
Mermaid diagrams - finally!
The request to support Mermaid diagrams in Marp dates back to 2016, about 10 years ago.
Although Mermaid and Markdown are a natural combination in today, reliably rendering Mermaid inside Marp has been a long-standing challenge. We could not confidently ship it as a core feature until achieve consistent and reliable rendering across different JS environments, server, client, worker, etc.
Marp Core v5 finally makes this possible, powered by using
beautiful-mermaidto generate deterministic SVG diagrams.Supported diagrams
These are based on beautiful-mermaid:
Check out the Mermaid diagram documentation for details in Marp Core.
New syntax highlighting
Marp Core v5 introduces new syntax highlighting powered by Shiki.
Shiki uses TextMate grammars, as does VS Code. It provides accurate highlighting and broad language support. In most cases, the effect on appearance is very slight.
Line highlighting
v5 added a new feature to highlight specific lines in code blocks. You can specify line numbers to highlight after the language, as shown below:
Color definitions
Previous syntax highlighting used
.hljs-*classes, which made it difficult to customize styles in complex cases such as custom color-scheme classes and theme inheritance.For making customization simple, v5 introduces a new approach that consolidates colors into about a dozen CSS variables. You also can use the
light-dark()function to support both light and dark color schemes.Please review
.hljs-*classes in your style for syntax highlighting, and replace them with--marp-shiki-*CSS variable definitions.See the documentation of color definitions for details.
A lightweight core by default for developers
Note
This section is for developers who use Marp Core as a library. If you are a user of Marp CLI (without engine customization) or Marp for VS Code, you can skip this section.
While adding highly requested features to Marp is welcome, the resulting bloat is a major concern for developers embedding Marp into their apps. Marpit framework solves this, but its bare-minimum features can be difficult for some.
Marp Core v5 makes the main
@marp-team/marp-corepackage lightweight by separating 4 features, including Mermaid and Shiki, into core plugins with external dependencies. Developers can now choose only what they need for their apps.@marp-team/marp-core: A lightweight core with only essential features@marp-team/marp-core/plugins/shiki: Core plugin for syntax highlighting (Requiresshiki)@marp-team/marp-core/plugins/mermaid: Core plugin for Mermaid rendering (Requiresbeautiful-mermaid)@marp-team/marp-core/plugins/katex: Core plugin for KaTeX math typesetting (Requireskatex)@marp-team/marp-core/plugins/mathjax: Core plugin for MathJax math typesetting (Requires@mathjax/srcand 4 font packages)Check out README for details.
Comparison
Rough estimates for a minified browser ESM build before gzip. The full build includes all optional dependencies.
A lightweight core of v5 is 83.9% smaller than v4, and 95% smaller than v5 full.
Full build
Marp Core also provides a full build
@marp-team/marp-core/fullthat includes all core plugins. It's useful for developers who want to migrate from v4.If v5 becomes stable, the Marp ecosystem toolchain is going to use the full build, so there is no functional loss in Marp CLI and VS Code extension.
Prepare for v5
This is a guide for testing v5 features in Marp CLI. For future release of Marp ecosystem toolchain, Markdown authors and theme desingers can prepare for v5 full build.
Create a new Node.js (20.19+) project, and install Marp CLI v4.5.1 and Marp Core v5 (
nexttag).Install dependencies required by core plugins, by following https://github.com/marp-team/marp-core#core-plugins.
Run Marp CLI.
Helpful resources
For better stable release, please give the release candidate a try, and let me know your feedback! 📮
All reactions