Background
The code highlighting functionality highlight.js
is not enabled for ABAP language for Hexo by default. You can follow the below guide to enable it.
Setup
1. Update the file .\node_modules\highlight.js\lib\index.js
under Hexo base folder, and add the below code
1 | hljs.registerLanguage('abap', require('./languages/abap')); |
2. Create a file .\node_modules\highlight.js\lib\languages\abap.js
under Hexo base folder, and add the below code
The ABAP language syntax file is downloaded from GitHub, adjusted as below.
- Add
module.exports =
at the beginning - Adjust the comment end tag from
'\n'
to'$'
- Correct some typos in the keywords
1 | module.exports = function(hljs) { |
3. Create a file .\node_modules\highlight.js\styles\abap.css
under Hexo base folder, and add the below code
The ABAP language css file is downloaded from GitHub.
1 | /* |
4. Update the file \node_modules\hexo-util\highlight_alias.json
under Hexo base folder
Add the below field-value mappings to alias object
1 | "abap": "abap", |
Add the below value to languages array
1 | "abap", |
Result
Run hexo clean
, hexo generate
to generate the files. Below is the result with ABAP code highlighting.
1 | select * from edisyn into table i_edisyn |