Skip to content
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

feature: Support Github Markdown "Alerts" #310

Open
Sajjon opened this issue Aug 22, 2024 · 3 comments
Open

feature: Support Github Markdown "Alerts" #310

Sajjon opened this issue Aug 22, 2024 · 3 comments
Labels

Comments

@Sajjon
Copy link

Sajjon commented Aug 22, 2024

Problem:

Seems this (great) tool does not support Github Markdown "alerts", at least not without any extra options?

Solution:

Would be excellent to support it! Since "Alerts" are so fancy and getting traction amongst repos on Github.

@Sajjon Sajjon added the feature label Aug 22, 2024
@simonhaenisch
Copy link
Owner

Hm might just be an issue with how outdated the marked version I use is 🙈 I've been wanting to update it for a long while. l'll try to get to it this week.

In the meantime you can check whether markedjs/marked actually supports this at all?

@Sajjon
Copy link
Author

Sajjon commented Aug 23, 2024

In the meantime you can check whether markedjs/marked actually supports this at all?

Looks like it, see markedjs/marked#3010 which references an extension on marked, https://github.com/bent10/marked-extensions/tree/main/packages/alert

can you use those, extensions on marked??

@simonhaenisch
Copy link
Owner

Yeah you can, but i also have an open issue about it 🙈 (#292)

You'd need to use a md-to-pdf.config.js file (can name it whatever you want) and pass that to the CLI with --config-file ./md-to-pdf.config.js flag, then you can use it to configure marked_extensions, sth like:

const markedAlert = require('marked-alert')

module.exports = {
  // ... other config
  marked_extensions: [markedAlert],
}

But the way marked_extensions is passed to the Marked instance is not aligned with their new .use() API interface, so I can't guarantee this actually works until #292 is solved. Maybe just give it a try and if it doesn't work it gives me some motivation to finally fix this (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants