How does one configure Jekyll & Rouge to specify that one language should be highlighted using the parser of another language.
For example, I want to be able to do this in my markdown source files:
```nodejs-repl
> foo();
Uncaught ReferenceError: foo is not defined
```
... but have that code block syntax highlighted using the same syntax highlighter Javascript language parser.
I want to do this for a couple of reasons:
- Semantic correctness in the source files
- Be able to run tools such as prettier and have them bypass these code blocks
Rouge already does have the concept of language aliases (see example below), however is it possible to specify a custom language alias via Jekyll, and if so how can this be done?
Details:
(1)
I am using Jekyll 3.8.5 with Rouge 3.11.0.
(2)
The following is the relevant part of my Jekyll config file:
highlighter: rouge
(3)
So as to be really clear about what "language aliases" refers to, I'll provide an example:
For Javascript, you can use both js
and javascript
after the code fences,
as they are language aliases by default in Rouge.
Thus, the following two code blocks are identical:
Using language alias js
:
```js
foo();
```
Using language alias javascript
:
```javascript
foo();
```