Add cli option to exclude presenter notes from HTML output
Currently, Marp cli includes presenter notes in the generated HTML output.
While these notes are hidden in the presentation view and only visible in presenter mode (via the 'P' key), they remain in the HTML source code.
Use Case:
When sharing HTML presentations with clients or external parties, presenters may want to completely exclude their internal notes from the deliverable file, rather than just hiding them visually.
Proposed Solution:
Add a cli flag to exclude presenter notes from the output.
Example:
marp presentation.md -o output.html --skip-notes
Current Workarounds:
- Manually removing notes from source markdown
- Post-processing HTML with scripts
- Maintaining separate versions of presentations
Benefits:
- Cleaner deliverables for client-facing presentations
- No risk of exposing internal notes
- Simpler workflow for users who share presentations
For now, it's available by providing an engine that has a plugin to remove presenter notes.
marp presentation.md -o output.html --engine skip-notes.mjs
// skip-notes.mjs
const removePresenterNotesPlugin = (md) => {
md.core.ruler.before('marpit_collect', 'marpit_mark_comments_as_parsed', (state) => {
if (state.inlineMode) return;
for (const token of state.tokens) {
if (token.type === 'marpit_comment') token.meta.marpitCommentParsed ||= 'remove_presenter_notes_plugin';
}
});
};
export default ({ marp }) => marp.use(removePresenterNotesPlugin);
Thanks @yhatt ! I still think this should be a native feature, but your workaround works like a charm!
If so, it should be a feature flag for the bespoke template, such as --bespoke.notes=false, because the output of presenter notes is a feature specific to the bespoke template. In fact, also when switching to the bare template by --template bare, presenter notes are not output in HTML.