Skip to content

Bespoke with Marp Core #57

Answered by yhatt
TheodoreChu asked this question in Q&A
Dec 26, 2020 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

It looks like the problem of your code rather than Marp's problem.

The simplest way is just to concatenate the output string and stringified extra scripts. Taking this will NEVER escape characters because there is no processing to both scripts.

const script = 'alert("your bespoke code")'

const { css, html } = marp.render(markdown)

const output = `
  <style>${css}</style>
  ${html}
  <script>${script}</script>
`

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TheodoreChu
Comment options

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