marp-team / marpit

The skinny framework for creating slide deck from Markdown
https://marpit.marp.app/
MIT License
963 stars 46 forks source link

Add anchor constructor option for slide anchor customization #340

Closed yhatt closed 2 years ago

yhatt commented 2 years ago

Framework users can control id attribute for each slides by setting anchor constructor option.

// Set page number as anchor (id attribute)
new Marpit({ anchor: true })  // <section id="1">
new Marpit({ anchor: false }) // <section>

// Custom anchor: <section id="page-1">
new Marpit({ anchor: (pageIndex) => `page-${pageIndex + 1}` })