marp-team / marp-core

The core of Marp converter
MIT License
784 stars 132 forks source link

Toggle additional features through theme metadata #72

Closed yhatt closed 5 years ago

yhatt commented 5 years ago

Motivation

I have concerned that Marp Core's additional feature (especially auto-scaling) makes theme creation difficult for theme author compared to Marpit.

Typically our presentation app will release with Marp Core, so we have to focus the theming experience within Core. Marpit allows to create theme based on ours, but a fully customized theme requires knowledge of Marp Core. The typical example is --preserve-aspect-ratio variable for alignment in auto-scaling.

We aim to be able to create theme CSS by everyone who familiar with general CSS and HTML markup. So these definitions might prevent our way.

Proposal

By using theme meta, a theme author will make be toggleable our additional feature of Marp Core. Meta flags should support in additional features that have to consider the complex CSS style.

/**
  * Marp core theme
  *
  * @theme theme-name
  * @auto-scaling true
  */ 

If the author has not defined meta, the additional feature does not work in a specified theme.

Currently, we can already recognize @fittingCode (for UNCOVER theme), and this proposal is a generalization of it. The other example of an additional feature that has to consider styling is the footnote. (See: yhatt/marp#2)

yhatt commented 5 years ago

v0.8.0 was shipped out with this change.

Migration

Theme author requires just to add /* @auto-scaling true */ to theme CSS. And don't need to change anything if you are using Marp Core's official theme through @import rule.