Git Product home page Git Product logo

marpit's Introduction

Marpit Marpit

Marpit: Markdown slide deck framework

CircleCI Codecov npm LICENSE


Marpit /mɑːrpΙͺt/ is the skinny framework for creating slide deck from Markdown. It can transform Markdown and CSS theme(s) to slide deck composed of static HTML and CSS and create a web page convertible into slide PDF by printing.

Marpit is designed to output minimum assets for the slide deck. You can use the bare assets as a logicless slide deck, but mainly we expect to integrate output with other tools and applications.

In fact, this framework is created for using as the base of a core converter in Marp ecosystem.

Features

We have extended several features into markdown-it parser to support writing awesome slides, such as Directives and Slide backgrounds. Additional syntaxes place importance on a compatibility with general Markdown documents.

Marpit has the CSS theming system that can design slides everything. Unlike other slide frameworks, there are not any predefined classes and mixins. You have only to focus styling HTML elements by pure CSS. Marpit would take care of the selected theme's necessary conversion.

Optionally <svg> element can use as the container of each slide page. It can be realized the pixel-perfect scaling of the slide only by CSS, so handling slides in integrated apps become simplified. The isolated layer made by <foreignObject> can provide advanced backgrounds for the slide with keeping the original Markdown DOM structure.

We not provide any themes because Marpit is just a framework. You can use @marp-team/marp-core if you want. It has the official themes, and practical features extended from Marpit.

Getting started

See the documentation of Marpit to get started.

Contributing

Are you interested in contributing? See CONTRIBUTING.md and the common contributing guideline for Marp team.

Development

git clone https://github.com/marp-team/marpit
cd marpit

yarn install
yarn build

Sub-projects

Author

Managed by @marp-team.

License

This framework releases under the MIT License.

marpit's People

Contributors

creaticoding avatar dependabot[bot] avatar janinawibker avatar jerols4 avatar jugmac00 avatar ms10596 avatar yhatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

marpit's Issues

Fragmented list

We are considering to support the fragmented list, to appear the content of lists one by one.

CommonMark provides some markers for building list. The unordered list allows using -, +, and *, and the ordered list allows 1. and 1). We want to parse the less frequency-used marker as the fragmented list, and let it parsable as fragmented in Marpit integrated tools (e.g. Marp Core and integrated apps).

<!-- Regular list -->
- One
- Two
- Three

1. One
2. Two
3. Three

---

<!-- Fragmented list -->
* One
* Two
* Three

1) One
2) Two
3) Three

Currently, Marpit will render a pair of pages with exact same DOM structures by parsing this example.

<section>
  <ul>
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
  </ul>
  <ol>
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
  </ol>
</section>

When using * or 1), Marpit would add data-marpit-fragment data attribute to the list and show the fragmentation level. The slide container (<section>) would be added data-marpit-fragments attribute to store the total fragmentation level of the page.

<section data-marpit-fragments="6">
  <ul>
    <li data-marpit-fragment="1">One</li>
    <li data-marpit-fragment="2">Two</li>
    <li data-marpit-fragment="3">Three</li>
  </ul>
  <ol>
    <li data-marpit-fragment="4">One</li>
    <li data-marpit-fragment="5">Two</li>
    <li data-marpit-fragment="6">Three</li>
  </ol>
</section>

It allows parsing data attributes by integrated apps. For example, Marp CLI's bespoke template, using Bespoke.js, can parse and allow one-by-one appearing by using a plugin based on bespoke-bullets.

Current draft is scalable for the other elements, so we don't expect to use bespoke-bullets as is.

Similar requests are reported to yhatt/marp: yhatt/marp#55 and yhatt/marp#257. These suggestions will probably allow any elements as the fragmented target, but it might require to manipulate rendered DOM to wrap by the element whose data-marpit-fragment in some cases. Marpit hates implicit DOM manipulation because it may break CSS theme, so we focus on the list first. (Resolves yhatt/marp#89)

Image syntax for text color

We are considering to add the shorthand for color spot directive. It looks like #92, but it's working for text color.

They would return the same result:

![](red)
<!-- _color: red -->

style not working

---
<style>
section {
  background: yellow;
}
</style>
Hello world
===

expected to produce

Hello world

only, but got

<style>
section {
  background: yellow;
}
</style>
Hello world

Disable styling html and body elements through theme CSS

At first, we designed Marpit theme CSS that is stylable into <html> and <body> elements. It meant the theme CSS can use as the plain styling for converted HTML without CSS conversion by Marpit.

However, it will give an unexpected surprise to the application creator that has integrated Marpit. In addition, it might give a chance to insert the malicious code by the attacker.

if (/^(:marpit-container|html|body)(?![\w-])/.test(selector))
return selector

We would no longer have to give a special treatment to html and body.

Custom directives

Currently, Marpit directives cannot customize by the user. For more extensibility, we are planning that the extended class allows adding custom directives.

For example as the use case, it allows enabling slide preview only by writing marp: true directive, in Marp plugin for the existing Markdown editor. (VSCode, Atom, and so on)

---
marp: true
---

Support CSS Animation keyframes within the scoped style

When defining keyframes for CSS Animations through inline style in Markdown, the author cannot use <style scoped>. It would emit invalid style like #97 if used.

<style scoped>
@keyframes foobar {
  from { width: 123px }
  to { width: 456px; }
}
</style>
@keyframes foobar {
  section[data-marpit-scope-lYmIl9Fz] from { width: 123px }
  section[data-marpit-scope-lYmIl9Fz] to { width: 456px; }
}

I suppose @keyframes within the scoped style would be better for defining animation in the current slide page, without considering conflict with global animation names.

We can learn the implementation of scoped style from @vue/component-compiler-utils.

ToDo

  • Fix invalid scoping for @keyframes (#236)
  • Generate unique animation name when using @keyframes
  • Replace animation definitions within scoped style into the generated name
    • Also consider the case to reference global keyframes: Replace only matched keyframes in scoped style on the current page
  • Generate unique identifier per each slide pages
    • It means 2 and more <style scoped> in the same page will generate the same identifier

Support HTML output as array consisted of slide pages

Marpit is just a wrapper of markdown-it. Thus, currently we always return the converted plain string of HTML.

However, returning as array consisted of each slide pages would help creating more controlled slide page in some cases.

The strong motivation is caused from the note template working in marp-team/marp-cli#52. It has an ugly logic to split string directly, and might break by user's Markdown input.

https://github.com/marp-team/marp-cli/blob/cbaa24457b22773ee82c5b586c3b568b69819232/src/templates/index.ts#L78-L82

Leaked print header and footer appear when printing Marpit deck inside iframe

Recently we found a strange case: the unexpected print header and footer is appeared.

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

const marpit = new Marpit()
const { html, css } = marpit.render('# Hello')

fs.writeFileSync('deck.html', `<!DOCTYPE html><html><body><style>${css}</style>${html}</body></html>`)
<!DOCTYPE html>
<html>
  <body>
    <iframe src="deck.html" id="iframe"></iframe>
    <button onclick="document.getElementById('iframe').contentWindow.print()">Print</button>
  </body>
</html>

When you hit "Print" button in Chrome 71, print header and footer are appeared in print preview. But it would disappear if you change any print option.

A printed PDF is here.

We should be expected to hide print header and footer by default.

[RFC] The future plan of Marpit (delayed)

This is a RFC (Request for Comments) document for next major version of Marpit and the content may change.

Do you have interested in the future of Marpit? We always think listening opinions from Marp / Marpit community is the best rather than working with our dogmatic decision. We want your feedback for keeping to evolve Marp ecosystem! πŸ’¬


UPDATE: Following plans are delayed after v2.


Marpit has reached stable v1 in May 2019. And this is a roadmap to the next stable.

Marpit v2 in the future focuses to the enhancement as more universal framework for creating slide deck. We hope to make a basis of extensibility that is applicable not only to Marp ecosystem but also to other popular slide frameworks, reveal.js, WebSlides, and so on.

Perhaps v2 the future version of Marpit would be full-rewritten, but most of features and syntax won't change unlike Marp -> Marp Next.

Rename project

At first, we have to explain planning to rename project.

Marpit was a coined word named from Marp and "it" suffix, in honor of markdown-it library. However, we found that "marpit" has a violent meaning in Hindi.

Project name is important. We fear that some people are keeping a distance from our project just by the image of name. So we think Marpit should change the name into a word which remind no special meanings.

Moving to TypeScript (#136)

Marpit is an only project built on JavaScript (ECMAScript) in our mainstream projects. Marpit's type definition is defined in /index.d.ts but it's hard to maintain together with JS.

Usefullness of TS has already proved in other projects. By moving to TS, developer experience will improve not only for Marpit but also for plugins.

UPDATE: TS migration is going to start from v2 step by step. v2 will allow remaining JS by allowJs: true.

Choose Markdown parser and make clear specification for plugin

For common Marp user, an internal parser is not too important. On the other hand, user that getting annoyed for lacked syntax in CommonMark have to consider using plugin to extend syntax.

Marpit aims to the extensible framework by plugins, and hopes to spread plugin ecosystem. However, unfortunately Marpit v1 plugin by community is hardly created and used yet.

We think currently the support for plugin author is very weak. For example, the specification document of Marpit tokens (AST) has not provided at the moment. In addition, we think restrictions by parser's architecture may make plugin development harder.

v2 will be the best timing if Marpit replaces a parser and specification into a promising.

markdown-it

Currently Marpit v1 is using markdown-it as our base parser. It is working over the years, well-maintained, and easy to extend through plugins.

However, there are some restrictions that come from its architecture:

  • Cannot use async functions while parsing (In fact prevents implementing #135)
  • There is not character-level source mapping

Nevertheless, using markdown-it parser continuously in Marpit v2 might be OK. Marpit v1's core implementations are very stable, tokens with plain structure are easy to extend, and not required cons shown in above anyway. If the specification is well-documented, it may have no problem for plugin author.

remark

remark (NOT Markdown presentation template) is a modern and popular parser without above restrictions. In fact, some tools that have same purpose of Marp are supporting remark.

  • mdx-deck, for creating slide deck based on MDX parser extended from remark, is earned 8k stars about the same of outdated Marp app.
  • According to recent trending, fusuma, to create WebSlides based slide deck (3.5k stars), is also powered by remark-based MDX.
  • In fact Marp for VS Code is parsing Markdown by remark, to get characeter-level source map for warning.

VS Code's markdown engine is based on markdown-it. So Marp for VS Code might have to change the logic drastically if Marpit moved to remark.

MDX (Based on remark)

About MDX, we are taking a dim view because Marp requires only standard knowledges, such as Markdown, HTML, and CSS. However, actually it's popular in some tools so leaving extensibility for MDX makes a value.

Which is better?

That is the question to Marpit plugin author.

Both parsers have pros and cons. We want to hear an opinion from users interested to develop Marpit plugins.

Get rid of instance dependent parsing

Some internal plugins and classes are dependent on values defined in Marpit instance, such as lastGlobalDirectives, lastComments, lastStyles etc...

We should get rid of them and change to store values to the context object created within render().

Layer for Inline SVG mode

"Layer" is new concept available only in inline SVG mode, to make the layout system generalize.

Marpit v1 has advanced backgrounds to apply complex layout with keeping original DOM structure of Markdown (e.g. Multiple backgrounds, Split slides inspired from Deckset, etc...) They features are not changed in v2 too.

A current problem is too complex parse & build process of them. Leaving these logics may make it difficult to maintain.

As the discussion on #137 shows, the idea of layout using inline SVG is profitable. We have no plans to add that as the built-in feature at present, but we want to be making useful layouts become easy to create in plugin.

In v2 future, we will organize layout system for inline SVG as a new concept "Layer", and make easy to manipulate and extend through Marpit plugin.

Concept

At first, let's review v1's inline SVG rendering.

# Hello, Marpit!

This Markdown will convert into like this:

<svg data-marpit-svg viewBox="0 0 1280 720">
  <foreignObject x="0" y="0" width="1280" height="720">
    <section id="1">
      <h1>Hello, Marpit!</h1>
    </section>
  </foreignObject>
</svg>

When Markdown is using background image(s) through ![bg](), children of <svg> element will have a huge change.

![bg](background-image.jpg)

# Hello, Marpit!
<svg data-marpit-svg viewBox="0 0 1280 720">
  <foreignObject x="0" y="0" width="1280" height="720">
    <section data-marpit-advanced-background="background">
      <div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal">
        <figure style="background-image: url(&quot;background-image.jpg&quot;);"></figure>
      </div>
    </section>
  </foreignObject>

  <foreignObject x="0" y= "0" width="1280" height="720">
    <section id="1" data-marpit-advanced-background="content">
      <h1>Hello, Marpit!</h1>
    </section>
  </foreignObject>

  <foreignObject x="0" y="0" width="1280" height="720" data-marpit-advanced-background="pseudo">
    <section data-marpit-advanced-background="pseudo"></section>
  </foreignObject>
</svg>

Now you can see 3 <foreignObject> elements: for background images, main contents, and pseudo-layer like pagination defined by section::after in theme CSS.

They can define the position and size of content declaratively in DOM, so it becomes easy to control layout such as split slides.

In Marpit v2 for the future, we will treat each <foreignObject> as "Layer" of a slide, and provide interface to add and modify layer contents, position, and stacking orders programatically. (A detailed interface is not defined yet)

Contents layer

Each slide page must have the contents layer for placing original DOM converted from Markdown.

Plugin that provides additional layer will pick required elements from the contents layer, and append them to new layer. For example, advanced background plugin will pick ![bg]() from the contents layer, and append to the background layer.

Layers in regular conversion (v3?)

In addition, we also have an idea for layers in regular conversion by using nested <section>.

<section id="1" data-marpit-layer="true">
  <!-- Layer for background -->
  <aside data-marpit-layer="bg" style="top:0; left:0; width:1280px; height:720px;">
    <figure style="background-image: url(&quot;background-image.jpg&quot;);"></figure>
  </aside>

  <!-- Contents layer -->
  <section style="top:0; left:0; width:1280px; height:720px;">
    <h1>Hello, Marpit!</h1>
  </section>
</section>

We don't think that can realize immediately because it must consider manipulating theme CSS. But if it was realized, Marpit would grow extensibility to other framework, especially reveal.js. By using additional layer(s), Marpit can generate vertical slides for reveal.js.

# Marpit extensibillity for reveal.js

---

## Vertical slides

***

## with layer
<section id="1">
  <h1>Marpit extensibillity for reveal.js</h1>
</section>

<section id="2" data-marpit-layer="true">
  <!-- Contents layer -->
  <section>
    <h2>Vertical slides</h2>
  </section>

  <!-- Additional layer generated by plugin -->
  <section>
    <h2>with layer</h2>
  </section>
</section>

W3C has the public working draft for cascade layers in CSS cascading and inheritance Lv5. It is not meaning to separate styles for contents and we think it's too early to adopt that, but it has a worth to consider for using to style Marpit theme.

Others

  • Make PostCSS compiler for theme CSS be pluggable

Support <style scoped> to apply inline style to current page

By default, the content of inline <style> is appended to the end of theme and would effect to whole of slide deck. It is useful for tweaking current theme, but we thought some people want to apply style only to current page.

Currently it could apply customized section CSS to single page by the combination with class spot directive.

<!-- _class: title -->

<style>
section.title h1 {
  text-align: center;
}
</style>

# Centered!

---

# Aligned to left

However, this way is a bit verbose. If you don't intend to re-use style, it may nice to be able writing scoped style to current page like this:

<style scoped>
h1 {
  text-align: center;
}
</style>

# Centered!

It would convert into scoped HTML and CSS. The scoping target is section element for slide page.

<section data-marpit-scope-d318a2c1>
  <h1>Centered!</h1>
</section>
section[data-marpit-scope-d318a2c1] h1 {
  text-align: center;
}

We would have to make it be able to change enable or disable in Marpit constructor. <style scoped> is already removed from the specification of HTML, and not supported on modern browsers. Nevertheless, this syntax is still favored in Vue component.

Video syntax support

We are considering to support video by Markdown image syntax. It could provide better video experiences like Deckset, on the HTML slide deck.

Also refer to yhatt/marp#60.

<!-- Inline video -->
![](video.mp4)
![w:640 h:480](video.ogv)

<!-- Meta keywords -->
![autoplay loop muted](video.mp4)

<!-- Background video (only in advanced background mode) -->
![bg](video.mp4)
![bg 200%](video.mp4)

Basically these would be converted into HTML5 <video> elements.

Planning features

Do πŸ‘

  • Convert image syntax ![]() with video extension into <video> element
  • Support inline video
  • Support background video in advanced backgroud mode
  • Resizing video with the current syntax: width, height, and syntax for background (keyword and percentage)
  • Parsing meta keywords known in HTML5: autoplay, loop, muted (and mute alias for compatibillity of Deckset)

Considering πŸ€”

  • Follow Deckset's YouTube support: ![](https://www.youtube.com/watch?v=ZwzY1o_hB5Y) (An another issue?)

Don't πŸ‘Ž

  • Playback controll by Marpit
    • Marpit only have to be responsibility for conversion. Whether to follow autoplay meta keyword should decide within integrated apps (e.g. marp-core, marp-cli, marp-web...).

Restrictions

In inline SVG mode, Chromium's rendering bug 467484 will affect to <video> elements. But it would be fixed by an experimental BGPT feature (--enable-blink-gen-property-trees).

Add percentage of 'right' or 'left' to bg image directive

Hello @yhatt, what is your opinion about adding a percentage to the [bg left]/[bg right] directive? Currently, these split the slide at 50%, but if say we did [bg left w:33%], this would mean that the bg image spans one-third of the slide and the text takes up the remaining two-thirds. Will it be possible to add this by any chance?

PS: Thank you so much for making Marp happen!

Set background color by markdown image syntax

Related to yhatt/marp#252.

Marpit is already supported backgroundColor directive. But when you want to change color in a single page, it requires:

  • A knowledge of difference between local and spot directives
  • A lot of typings
  • Strict YAML formatting
<!-- _backgroundColor: "#def" -->

A suggestion in yhatt/marp#252 is very useful in this case. You may write the color code as like as the background image syntax.

<!-- Color keywords -->
![bg](red)

---

<!-- Hex color -->
![bg](#39ffaf)

It would allow color keywords, transparent, currentColor, and RGB colors with hexadecimal notation #123abc. It has the same behavior to backgroundColor spot directive.

The functional notation like rgb(0, 128, 255) might break Markdown (CommonMark) image syntax by whitespace. To support functionals is no problem, but we should tell this problem to user.

Collect unparsed comments to rendered object for presenter notes

To implement presenter notes, we are planning that HTML comments whose not to recognize as YAML object for directives will collect and return in the result object of Marpit.render().

<!-- theme: test-theme -->

# First page

<!-- This HTML comment is not YAML, so it would be collected. -->

---

## Second page

---

### Third page

<!-- It would be collected per pages. -->
<!-- These are expected to use as presenter note. -->
{
  html: '<div class="marpit"><section>...</section></div>',
  css: '.marpit > section { ... }',

  // Collected comments
  comments: [
    ['This HTML comment is not YAML, so it would be collected.'],
    [],
    [
      'It would collect per pages.',
      'These are expected to use as presenter note.',
    ],
  ],
}

At first we had planned to implement this feature in marp-core. But to decide a specification of comment in framework-level is better than implementation at inherited class.

Related to yhatt/marp#30.

Add a document title for HTML slides

How to add the document title for my html slides, so that I can see one title on the browser tab. Especially when the html link is added to favorites, it's useful to find it quickly.

center image

I there a way to center the image on a slide with the new Marpit engine ?
I used to set ![50% center](myimg.png) but both the percentage and position seem to not work anymore.

Remove dollar prefix alias for global directive

Recently I saw some media that introduces Marp ecosystem with the wrong how to use $ prefix.

Some media are explaining that <!-- $backgroundColor: #ff8800 --> can change background color in the whole of slides, but it's not true. $ prefix is just an alias into the unprefixed directive and only for global directives: theme, style, and headingDivider. In fact, $ prefix for local directives is invalid. $backgroundColor would never affect the view of slide.

The dollar prefix in Marpit's global directive is for keeping compatibility with the old Marp app and reducing some troubles while migration. (We recognize there are some people still cannot move to brand-new Marp from the old app like marp-team/marp-cli#85)

However, it brings Marp user misunderstanding for the new syntax as a fact. We had better discard the old syntax once in a while.

It may give bigger impact than we think, so we should allow to provide escape hatch by defining dollar-prefixed custom directives.

example does not paginate

Hi, I used the example code to make html/css, it compiles and makes a file. But... it does not paginate in Chrome or Safari.

Do I need to implement onepage-scroll or such myself, or is there a style sheet I should use?

Type setting for theme metadata

We are considering to support type setting for theme metadata specified in the metaType option in Theme#fromCSS, ThemeSet#add, and ThemeSet.metaType member.

Currently theme metadata only allows a single value. This behavior is very natural because Marpit only requires @theme metadata.

But in the extended class as like as Marp Core, there may be the meta key want to allow multi-time definitions. Thus, we should accept metaType option when creating Theme instance.

It is an object that has a key as the name of metadata and a value as the specified type which of String or Array. We will parse meta as String by default, included undefined meta key. The user has to set Array if the theme allows multi-time definitions in same meta key.

/**
 * @theme example
 * @foo Single value
 * @foo allows only one string
 * @bar Multiple value 1
 * @bar Multiple value 2
 * @bar Multiple value 3
 */
const themeSet = new ThemeSet()

themeSet.metaType = {
  foo: String,
  bar: Array,
}

themeSet.add(css)

console.log(themeSet.getThemeMeta('example', 'foo'))
// => 'allows only one string'

console.log(themeSet.getThemeMeta('example', 'bar'))
// => ['Multiple value 1', 'Multiple value 2', 'Multiple value 3']

It requires in proposed marp-team/marp-core#91: The proposed @size metadata requires multi-time definitions.

/**
 * @theme foobar
 * @size 4:3 960px 720px
 * @size 16:9 1280px 720px
 */

ToDo

  • Allow metaType option value in Theme#fromCSS
  • [ ] Allow metaType option value in ThemeSet#add
    • Typically using theme with different type definitions would make confusion. Option argument to override metatype had better not allow.
  • Add metaType member in ThemeSet class to set the default type setting for ThemeSet#add
  • Reserve @theme metadata as String and disallow changing type
  • [ ] Support merging array in ThemeSet#getThemeProp

Feature request: custom theme for a single slide

I see that currently is possible to define a scoped style for a single slide with #94
this forces us to put CSS in the markdown file, making it less readable.
Since there is already support for custom CSS theme files, it would be great to assign a CSS class to a single slide and move the CSS in the theme file.
Adding a custom class to the section would be great.

Make public the wrapper function for creating Marpit plugin

Marpit has internal helper function to be helpful creating Marpit plugin. It's exposed in @marp-team/marpit/markdown/marpit_plugin and using in some Marp tools but it is private API yet.
https://github.com/marp-team/marpit/blob/master/src/markdown/marpit_plugin.js

We are considering to expose this interface as Marpit.plugin() static function and named export that can use through export { plugin } from '@marp-team/marpit'.

Our plugin ecosystem has compatible with markdown-it, but it would be good that there is a better interface to access Marpit internals.

Fragments without bullets

Is it possible to have elements (text, images etc) to appear in a slide without using fragmented lists? For example I want a image to appear but I don't want a dot beside the image.

Too little explanation for those directives.

I was writing a PPT using vscode and I found a little difficult to understand those directives for a beginner like me.Though I can find some clues in documentation like:

paginate | Show page number on the slide if you set true.
header | Specify the content of slide header.
footer | Specify the content of slide footer.
class | Specify HTML class of slide’s

element.
backgroundColor | Setting background-color style of slide.
backgroundImage | Setting background-image style of slide.
backgroundPosition | Setting background-position style of slide.
backgroundRepeat | Setting background-repeat style of slide.
backgroundSize | Setting background-size style of slide.
color | Setting color style of slide.

But I didn't find a parameter table or explaination, so it's still hard to use them.

Wrong documentation about @import rule for theme

Documentation says:

@import must precede all other statements excepted @charset. It follows the original specification.

However, this restriction is gone by #72. @import could work correctly in anywhere of the CSS root, because we have a roll-up process for @import and @charset before convertion. It becomes that @import and @import-theme behave almost same behavior while theme conversion.

We have to update documentation to avoid confusion.

Incorrect scoping in keyframes at-rule

@keyframes at-rule in theme CSS is not working by the incorrect element scoping.

/* @theme example */

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

Marpit v0.3.1 will convert into:

/* @theme example */

@keyframes spin {
  div.marpit > section from { transform: rotate(0deg); }
  div.marpit > section to { transform: rotate(360deg); }
}

Marpit is misrecognized from, to, and xxx% as the element.

Moving to TypeScript

Unlike the other marp-team projects, Marpit is developed by pure JavaScript. At the time starting to develop Marpit, we could not decide to adopt TypeScript.

Marpit has an independent type definiton by .d.ts file, but it is great to generate it from original source code. In a milestone of next major version, we should consider to move to TypeScript.

Split slides

I was wondering if there is a way to split the canvas in the same way as you can split the slide for background images, i.e. a two-columns layout?

At the moment, this is possible,

<!--Left hand side -->
# Some title
- item
- item

![](https://maybe.another.non-background-image.jpg)

<!--Right hand side -->
![bg right](https://example.com/backgroundB.jpg)

but wouldn't it be nice to be able to split the slides for non-image contents,

<!-- Left column -->
# Left hand side
- item
- item

<!--Right column -->
# Right hand side
- item
- item

or to even vertically split a column to include non-image contents or BG-images only within one column?

<!-- Left column -->
# Left hand side
- item
- item

<!--Right column -->
<!--Right top -->
![bg right-top](https://example.com/backgroundA.jpg)
<!--Right bottom -->
![bg right-bottom](https://example.com/backgroundB.jpg)

If this can not easily be added, I think it would already be very nice if this only works with BG-images.
Maybe this can be realized with additional keywords (e.g., left-top, left-bottom, right-top, right-bottom), like in the example above.

How to except title slide from total number of pages of pagination?

Hello, I love this tool.
Is it possible to skip the title slide and appendix slides in the sum of page counts data-marpit-pagination-total? And how can I do so?

the pagination style of my css thema is this:

section::after {
    font-size: 1.1em;
    content: attr(data-marpit-pagination) ' / ' attr(data-marpit-pagination-total);
  }

And I wrote <!-- paginate: false --> at the title slide and <!-- paginate: true --> at the second slide, so the second slide' s pagination was "2/10." I want to change it to "1/9."

HTML is not working

Previous marp was support inserting HTML-code into slide, but now all <, > will be replaced to &lt;, &gt;.

Is there any option to prevent this behavior?

Allowing for reusable content through includes

I wasn't sure whether this was a marpit or marp-core question, apologies if I got this wrong.

Is there any plan for an include directive that will allow me to have a separate file which will be imported at render-time?

For example:

---
theme: uncover
size: 4:3
---

# This is my first slide

---

<!-- include: static/content.md -->

---

# This will appear after the content contained within the include

This will permit me to use boilerplate text on all slidedecks, and make it much easier if information contained within the text changes, but also for things like church presentations where song words would need to be included in subsequent slidedecks.

Keyboard shortcut documentation

Are there docs on which keyboard shortcuts exist? I found a bunch of obvious ones for basic forward/back navigation through trial and error but looking for navigate-to-beginning etc.

Add video in slides

When <video ... flags are used to add a mp4 in slides, and export the md file to html. I find the video player can not display properly in chrome browser.
And Video cannot be automatically paused after you have flipped this page.
Marp for VS Code

More flexible fragments

Fragmented lists are great! Sometimes, though, I want to display the whole list at once. For example:

Here's my grocery list:



press right arrow

Here's my grocery list
* Milk
* Eggs

This seems to be a special case of being able to explicitly specify which fragments an element is visible for.

I know LaTeX Beamer has something like this. If there's a way to make it happen, I couldn't see it in the docs.

Support setting local CSS file in style global directive

Right now you can define a CSS style as a global directive to extend a base theme.
It appears this can only be written inline, e.g. from documentation:

---
theme: base-theme
style: |
  section {
    background-color: #ccc;
  }
---

If there is a considerable amount of styling being applied, it would be useful to be able define a local CSS style file and simply set its path in the style directive, e.g.:

---
theme: base-theme
style: "style.css"
---

style.css file would then contain

section {
    background-color: #ccc;
  }

Ignore some magic comment in collected HTML comments

Marpit can collect HTML comments written within Markdown while parsing and use them as presenter notes. Marp CLI has already supported conversion into PPTX with notes.

However, some comments would obstruct in notes. Prettier's magic comment (such as <!-- prettier-ignore -->, <!-- prettier-ignore-start -->, and <!-- prettier-ignore-end -->) is required to use Marpit's fragmented list because Prettier will format them (* and 1)) to regular markers (- and 1.). The problem is useless comments are remaining in notes.

We may consider to ignore well-known magic comments while parsing Markdown.

List of magic comments

  • Prettier
    • <!-- prettier-ignore -->
    • <!-- prettier-ignore-start -->
    • <!-- prettier-ignore-end -->
  • markdownlint
    • <!-- markdownlint-disable (...) -->
    • <!-- markdownlint-enable (...) -->
    • <!-- markdownlint-capture -->
    • <!-- markdownlint-restore -->
  • remark-lint (provided from remark-message-control)
    • <!-- lint disable ... -->
    • <!-- lint enable ... -->
    • <!-- lint ignore ... -->

⚠️ We only have to consider magic comments provided from the outside tool that may be used together with Marp/Marpit. Additional syntaxes like provided by markdown-it plugin would not consider because they can mark in the plugin, as parsed to prevent collecting.

allow raw html by global directive

I'm using marp through the vscode plugin, and I'd like to enable raw html in my slides to include an HTML table. I tried adding html: true in the global directives section, but it didn't work. Is there a way to do this?

Porting build process of docs style from marp entrance repo

Currently the build process about a style of Marpit document (https://marpit.marp.app/) is implemented in an entrance repo of Marp because we had expected to use style in other projects of ours. But we're planning to use Docusaurus at the entrance to build landing page and blog, so we no longer use have to build docsify style in the entrance.

We should be porting the build process of docsify style from marp-team/marp and execute while deploy to Netlify.

UPDATE: Currently Docusaurus team is working toward the next version. It's so awesome due to the plans resolving many cons, but we cannot use Docusaurus 2 now. So we're re-thinking to be going to use Gatsby instead of Docusaurus.

Changing to 4:3 slide

Hi, this is maybe not an issue. But it really troubles me as:

  • in old Marp, i can change slide size by using $size: 4:3.
  • now, I have been trying the new Marpit on VScode and web app. And, I have noticed that changing slide size need to be done by defining height and width of root section tag in style. well, the output result is like below.
    screenshot 2019-05-16 pm 11 06 58
    It left a blank space on the right that I don't know how to remove. I have tried exporting as pdf, html, and image. Is there something that I have done wrong, or ... ?
  • Using traditional 4:3 slide is quite important to me, as this is the only display ratio that I can have in workplace.

auto image size not working ?

Hi

Putting 'auto' in an image (not background image) to get automatic width doesn't seem to work:

---
marp: true
title: Marp CLI example
description: Hosting Marp slide deck on the web
theme: uncover
paginate: true
_paginate: false
---

![auto](https://www.netlify.com/img/press/logos/logomark.svg)

imagem

Is this not the correct way to automatically resize the image ?

Would be nice we could resize the image as percentage of slide width or height also on foreground images.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.