-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defining md.renderer.rules in custom engine with markdown-it-plugins #226
Comments
Thanks for helping to manage issues (#224 (comment)). Try this if using Marp CLI's custom engine: // custom-engine.js
const { Marp } = require('@marp-team/marp-core')
const markdownItFootnote = require('markdown-it-footnote')
module.exports = (opts) => {
const md = new Marp(opts).use(markdownItFootnote)
// Customize renderer
md.renderer.rules.footnote_block_open = () => (
'<h4 class="mt-3">Footnotes</h4>\n' +
'<section class="footnotes">\n' +
'<ol class="footnotes-list">\n'
);
return md
} NOTE: markdown-it-footnote is known as one of plugin not compatible with Marp / Marpit. Probably it would not work as you expected. |
Thank you, I changed Is this still on the roadmap to get something like footnotes on a slide/section basis? Another idea I had was to add a directive, sort of like footer and header, that way it would at least be easy to have a box somewhere on the slide to but image credits / links etc into. In a presentation that would be all I would use footnotes for. The styling and positioning would be much easier this way. |
Marpit and Marp Core must follow CommonMark, and footnote is not part of CommonMark so we have not any plan for built-in support. Marp team has a policy that we should not break CommonMark as far as possible. We have well-documented Marpit API to help making third-party plugins by our community. I wish that community develops and provides Marpit plugin for footnote per each slides. FYI Marp community has a precedent using |
About markdown-it-footnote is off-topic in this issue. Close to mark as resolved the original question. |
The link to tongijan looks like a good workaround, I will explore it further! Thank you so much for your help today and yesterday! |
Hi @simonmaris, I have a rather similar workflow and also would like to use footnotes in my markdonw-based slides. Can you, maybe, post your solution? When I added footnotes to one slide, they are rendered adjacent to the header and footer section on every slide and listed only on the last slide. Thanks in advance! |
Hi @StefanZander, maybe this solution works also for you: #300 (comment) |
This was mentioned in the comments above, but for easier discovery, there is a typo in the original code block example.
|
I am trying to create a custom engine combining marp-core and markdown-it-footnote to use with marp-cli. Currently my engine.js file looks like this:
This works great, but I would like to customize the markdown-it-footnote output, however I am struggling to add this the right way.
I couldn't find any examples of a custom engine that extends md.renderer.rules. I saw the official plugins like math using marpitPlugin, would this be the way to go?
I would be very grateful for a pointer or basic example!
The text was updated successfully, but these errors were encountered: