From e1e708f808e8e9d8fc2b0d75a363e5f9d2026c14 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Fri, 29 Jun 2018 21:21:35 +0900 Subject: [PATCH 01/14] [PLANNING] Add docs about heading divider --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/marpit.js | 2 ++ 2 files changed, 58 insertions(+) diff --git a/README.md b/README.md index f1bfac8e..566969ba 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,62 @@ footer: "![image](https://example.com/image.jpg)" > :information_source: Due to the parsing order of Markdown, you cannot use [slide background images](#slide-background) in `header` and `footer` directives. +#### [PLANNING] Heading divider + +This feature is similar to [Pandoc](https://pandoc.org/)'s [`--slide-level` option](https://pandoc.org/MANUAL.html#structuring-the-slide-show) and [Deckset 2](https://www.deckset.com/2/)'s "Slide Dividers" option. + +By using `headingDivider` global directive, you can instruct to divide slide pages automatically at before of headings whose larger than or equal to specified level. + +For example, the below 2 markdowns have the same output. + + + + + + + + + + + + + +
Regular syntaxHeading divider
+ +```markdown +# 1st page + +The content of 1st page + +--- + +## 2nd page + +### The content of 2nd page + +Hello, world! +``` + + + +```markdown + + +# 1st page + +The content of 1st page + +## 2nd page + +### The content of 2nd page + +Hello, world! +``` + +
+ +It is useful when you want to create a slide deck from a plain Markdown. Even if you opened an above example of `headingDivider` in general Markdown editor, it keeps a beautiful rendering without the obtrusive horizontal rulers. + ### Slide backgrounds We provide a background image syntax to specify slide's background through Markdown. Include `bg` to the alternate text. diff --git a/src/marpit.js b/src/marpit.js index 93f6d302..dc1866c7 100644 --- a/src/marpit.js +++ b/src/marpit.js @@ -45,6 +45,8 @@ class Marpit { * element(s) wrapping whole slide deck. * @param {boolean} [opts.filters=true] Support filter syntax for markdown * image. It can apply to inline image and the advanced backgrounds. + * @param {false|number} [opts.headingDivider=false] Start a new slide page at + * before of heading whose larger than or equal to specified level. * @param {boolean} [opts.inlineStyle=true] Recognize `