New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@marp-team/marpit

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marp-team/marpit

The skinny framework for creating slide deck from Markdown

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
increased by14.28%
Maintainers
1
Weekly downloads
 
Created
Source

Marpit

Marpit: Markdown slide deck framework

Travis CI Coveralls npm LICENSE


Marpit /mɑːrpɪt/ is the skinny framework for creating slide deck from Markdown.

It could transform the Markdown and CSS theme(s) to slide deck composed by static HTML and CSS. (powered by markdown-it and PostCSS)

  • Marpit Markdown - Based on CommonMark, and have extended Directives.
  • Clear markup - Marpit theme CSS has no own class, so you can focus on your markup.
  • Inline SVG slide (Experimental) - Support slide auto-scaling without extra JavaScript.

Marpit will become a core of the next version of Marp.

:warning: This framework is under development and not ready to use. In addition, we are not ready to accept your contributes because it is proof of concept about the next version of Marp.

Marpit Markdown

Marpit Markdown syntax focuses a compatibility with commonly Markdown documents. It means the result of rendering keeps looking nice even if you open the Marpit Markdown in a general Markdown editor.

Directives

Difference from pre-released Marp
  • Removed directives about slide size. Use width / height declaration of theme CSS.
  • Parse directives by YAML parser. (js-yaml + FAILSAFE_SCHEMA)
  • Support Jekyll style front-matter.
  • Global directives is no longer requires $ prefix. (but it still supports because of compatibility and clarity)
  • Page directives is renamed to local directives.
  • Spot directives, that is known as scoped page directive to current slide, has prefix _.

ToDo

  • Background image (must use only background-image style on <section>)
    • Parse ![bg] syntax
    • Auto layouting like Deckset
  • Header and footer directive
  • Slide page number

Markup

HTML output

The basic idea is that <section> element is corresponding to each slide. It is same as reveal.js.

<section>
  <h1>First page</h1>
</section>
<section>
  <h1>Second page</h1>
</section>

By default, Marpit wraps whole slides by <div class="marpit"> for scoping CSS.

<div class="marpit">
  <section>
    ...
  </section>
</div>

This container element(s) can change in Marpit constructor option. Also container: false can disable wrapping.

Theme CSS

:information_source: Marpit provides only the minimum style for scaffolding presentation, and does not provide default theme. You can use the @marp-team/marp package if you want (UNDER CONSTRUCTION).

In theme CSS, you need not think about the hierarchy of Marpit. All that you have to know is just that a <section> element becomes a slide.

/**
 * @theme marpit-theme
 */

section {
  width: 1280px;
  height: 960px;
  font-size: 40px;
}

h1 {
  font-size: 60px;
}

The Marpit instance has a themeSet member that manages usable themes in the theme directive of Marpit Markdown. You have to add theme CSS by using themeSet.add(string).

import Marpit from '@marp-team/marpit'
import fs from 'fs'

const marpit = new Marpit()
marpit.themeSet.add(fs.readFileSync('marpit-theme.css', 'utf-8'))

A specified theme will convert to static CSS in rendering by marpit.render(). It will make it printable to pdf, and add scope with the container element(s) to each selector.

Inline SVG slide (experimental)

:warning: This feature is experimental because of a Chromium issue. A workaround to style can enable by inlineSVG: 'workaround', but it will disable a few basic styling defined in theme CSS. It includes position, transform and overflow with scrolling (auto and scroll).

When you set inlineSVG: true in Marpit constructor option, the each <section> are wrapped by inline SVG.

<svg viewBox="0 0 1280 960">
  <foreignObject width="1280" height="960">
    <section>
      ...
    </section>
  </foreignObject>
</svg>

SVG elements can scale contents with keeping aspect ratio. If you are creating an app that integrated Marpit, it would become easy to handle the layout of slides by CSS.

If it combines with CSS Scroll Snap, we would not need to require any JavaScript logic for the simple HTML-based presentation.

API

Refer JSDoc: https://marpit.netlify.com/

Development

Under construction.

Contributing

We are sorry but currently we are not ready to accept your contribute because it is under developing for proof of concept.

Author

Managed by @marp-team.

  • Yuki Hattori (@yhatt)

License

MIT License

Keywords

FAQs

Package last updated on 28 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc