marp-cli icon indicating copy to clipboard operation
marp-cli copied to clipboard

Add cli option to exclude presenter notes from HTML output

Open fildafer opened this issue 1 month ago • 3 comments

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

fildafer avatar Dec 05 '25 10:12 fildafer

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);

yhatt avatar Dec 05 '25 10:12 yhatt

Thanks @yhatt ! I still think this should be a native feature, but your workaround works like a charm!

fildafer avatar Dec 10 '25 09:12 fildafer

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.

yhatt avatar Dec 11 '25 00:12 yhatt