File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 // hljs.registerLanguage('swift', require('highlight.js/lib/languages/swift'))
3838 hljs . registerLanguage ( 'xml' , require ( 'highlight.js/lib/languages/xml' ) )
3939 hljs . registerLanguage ( 'yaml' , require ( 'highlight.js/lib/languages/yaml' ) )
40+ // Register the plugin
41+ hljs . addPlugin ( {
42+ // https://gitlab.com/antora/antora-ui-default/-/issues/203
43+ // https://github.com/asciidoctor/asciidoctor/issues/3976#issuecomment-3449797396
44+ 'after:highlight' : ( result ) => {
45+ const callout = '<i class="conum" data-value="$1"></i><b>$1</b>'
46+ result . value = result . value
47+ . replaceAll ( / < s p a n c l a s s = " h l j s - s t r i n g " > \( ( \d + ) \) < \/ s p a n > / g, callout ) // YAML
48+ . replaceAll ( / \( < s p a n c l a s s = " h l j s - n u m b e r " > ( [ 1 - 9 ] | 1 [ 0 - 9 ] | 2 0 ) < \/ s p a n > \) $ / gm, callout ) // Java
49+ . replaceAll ( / \( ( [ 1 - 9 ] | 1 [ 0 - 9 ] | 2 0 ) \) $ / gm, callout )
50+ } ,
51+ } )
4052 ; [ ] . slice . call ( document . querySelectorAll ( 'pre code.hljs[data-lang]' ) ) . forEach ( function ( node ) {
4153 hljs . highlightElement ( node )
4254 } )
You can’t perform that action at this time.
0 commit comments