Skip to content

Repository files navigation

@marp-team/marp-core

CircleCI Codecov npm LICENSE

The core of the Marp converter.

Marp Core extends the Marpit framework with practical Markdown syntax, advanced features, official themes, and optional core plugins.

Important

⚡️ Release Candidate: Marp Core v5 is currently a release candidate, and this README documents v5. Current Marp tools may still use stable v4; see the v4 branch for v4 documentation.

Install

Marp Core v5 supports Node.js 20.19 or later, but we highly recommend using an actively supported Node.js version.

npm install --save @marp-team/marp-core@next

Entrypoints

Since v5, Marp Core has been split into a lightweight core and optional core plugins.

Entrypoint Description Bundled size*
@marp-team/marp-core Lightweight core with Marp's essential features 0.5MiB
@marp-team/marp-core/full Full build with all core plugins
(requires installing all optional dependencies)
11.4MiB
*: Rough estimates for a minified browser ESM build before gzip. The full entrypoint includes all optional dependencies.

The full build provides a consistent experience across the Marp toolchain. For your own application, we recommend the lightweight core with only the plugins you need.

About the @marp-team/marp-core/browser entrypoint, see the browser helper.

Core plugins

Marp Core also provides optional plugins for several core features. These often require additional dependencies along with Marp Core.

Plugin Feature Optional dependency
@marp-team/marp-core/plugins/shiki Syntax highlighting powered by Shiki shiki
@marp-team/marp-core/plugins/mermaid Mermaid rendering powered by beautiful-mermaid beautiful-mermaid
@marp-team/marp-core/plugins/katex Math typesetting powered by KaTeX katex
@marp-team/marp-core/plugins/mathjax Math typesetting powered by MathJax @mathjax/src
@mathjax/mathjax-bbm-font-extension
@mathjax/mathjax-bboldx-font-extension
@mathjax/mathjax-dsfont-font-extension
@mathjax/mathjax-mhchem-font-extension

To use @marp-team/marp-core/full, install every optional dependency along with Marp Core:

npm install --save \
  @marp-team/marp-core@next \
  shiki \
  beautiful-mermaid \
  katex \
  @mathjax/src \
  @mathjax/mathjax-bbm-font-extension \
  @mathjax/mathjax-bboldx-font-extension \
  @mathjax/mathjax-dsfont-font-extension \
  @mathjax/mathjax-mhchem-font-extension

Usage

Marp Core provides the Marp class, inherited from Marpit, so its basic usage is the same as Marpit.

import { Marp } from '@marp-team/marp-core'

const marp = new Marp()
const { html, css } = marp.render('# Hello, marp-core!')

Use @marp-team/marp-core/full instead when you want the full build.

See the Marpit usage documentation for more details.

With plugins

Add optional core plugins selectively by chaining use().

import { Marp } from '@marp-team/marp-core'
import katexPlugin from '@marp-team/marp-core/plugins/katex'
import shikiPlugin from '@marp-team/marp-core/plugins/shiki'

const marp = new Marp().use(shikiPlugin()).use(katexPlugin())

You can also add any Marpit-compatible plugin.

Documentation

Choose the guide that matches what you want to do:

Contributing

Interested in contributing? See CONTRIBUTING.md and the common contribution guidelines for the Marp team.

Author

Managed by @marp-team.

License

This package is released under the MIT License.

About

The core of Marp converter

Topics

Resources

Code of conduct

Contributing

Stars

1.1k stars

Watchers

9 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages