mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Add cairo support to highlight.js

Open wawel37 opened this issue 1 year ago • 5 comments

Hello!

We wanted to support a cairo inside the highlight.js. We use mdBook inside our build / package manager tool called Scarb, which has an option to generate markdown files with documentation and later be used by mdBook to generate a proper documentation html.

wawel37 avatar Nov 06 '24 10:11 wawel37

Can you say how you generated this? I do not see cairo as a supported language in highlight.js 10.1. If it isn't one of the built-in languages, I don't think I would want to include it. I think you should be able to include it as a js extension.

ehuss avatar Nov 06 '24 17:11 ehuss

Can you say how you generated this? I do not see cairo as a supported language in highlight.js 10.1. If it isn't one of the built-in languages, I don't think I would want to include it. I think you should be able to include it as a js extension.

Tbh, I just manually modified the rust rule in the minified highlight.js, as cairo is based upon rust.

I am fully aware that we can include our own JS extension with the mdBook result, and that's what we are actually doing right now. And it works. But the problem is that we don't actually run a mdBook for a user, so later on, the user has to replace the highlight.js himself. We wanted mdBook to support the cairo out of the box.

I also completely understand your concern. I will go and make a PR inside the highlight.js with cairo support, and later on come back here :)

wawel37 avatar Nov 07 '24 10:11 wawel37

I will go and make a PR inside the highlight.js with cairo support, and later on come back here :)

Unfortunately that won't help for now, since we are stuck on an old version of highlight.js and can't update.

ehuss avatar Nov 07 '24 14:11 ehuss

I will go and make a PR inside the highlight.js with cairo support, and later on come back here :)

Unfortunately that won't help for now, since we are stuck on an old version of highlight.js and can't update.

So just to be clear, there is no way to directly add a custom language (one that isn't natively supported by 10.1 highlight.js) to mdBook's highlight.js file, right?

wawel37 avatar Nov 25 '24 10:11 wawel37

Correct.

ehuss avatar Nov 25 '24 14:11 ehuss

:umbrella: The latest upstream changes (possibly #2681) made this pull request unmergeable. Please resolve the merge conflicts.

rustbot avatar Apr 30 '25 13:04 rustbot