Skip to content

Dynamic content on slides with JS #559

Answered by yhatt
j2deme asked this question in Ideas
Jan 16, 2025 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

CommonMark has HTML tag transparency for using JavaScript through <script> element. For security reason, Marp is blocked HTML tags for executing scripts by default, but it's up to you to allow that. :)

Just as you thought, Marp allows putting client-side JavaScript into Markdown to render dynamic contents on the browser, and injecting server-side JavaScript as Marp plugin to provide new syntax into Markdown. Our slides output is not depending on any frontend frameworks, so you can start from vanilla JavaScript (or integrate Marp Core with the framework you like).

A following example is using Chart.js in Marp. By enabling HTML in Marp tools, you can render chart within Marp slides.

---
marp: 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@j2deme
Comment options

@j2deme
Comment options

@yhatt
Comment options

Answer selected by j2deme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants