Replies: 2 comments 4 replies
-
// marp.config.js
const { Marp } = require('@marp-team/marp-core')
const highlightLines = require('markdown-it-highlight-lines')
module.exports = {
engine: (opts) => new Marp(opts).use(highlightLines),
} # markdown.md
```js {1,2,4-5}
function foo() {
return bar().then((res) => {
return res.doSomething()
})
}
```
<style>
.highlighted-line {
background-color: #ff0;
display: block;
margin: 0 -16px;
padding: 0 16px;
}
</style> npm i --save @marp-team/marp-core @marp-team/marp-cli markdown-it-highlight-lines
npx marp -c ./marp.config.js markdown.md |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
hakib
-
This is a neat feature, IMHO. Have you considered including "markdown-it-highlight-lines" in Marp out-of-the-box and classes to support this in the default themes, @yhatt ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there an easy way to highlight specific rows in a codeblock?
In Python markdown it looks like this:
I found this discussion but it looks related to the vscode extension.
What is the best way to enable syntax highligh in markdown code blocks using the marp CLI?
Beta Was this translation helpful? Give feedback.
All reactions