@@ -12,14 +12,12 @@ export function pluginCxxMark(): ExpressiveCodePlugin {
1212 context . codeBlock . getLines ( ) . forEach ( ( line ) => {
1313 if ( context . codeBlock . meta . includes ( "cxx-mark" ) ) {
1414 const matches = [
15- ...line . text . matchAll (
16- / \/ \* \$ ( ( (?< syntax > s ) | (?< exposition > e x p o s ) ) : [ ^ \* ] + | (?< optional > o p t ) ) \* \/ / g
17- ) ,
15+ ...line . text . matchAll ( / \/ \* \$ ( .+ ?) \* \/ / g) ,
1816 ] . reverse ( ) ;
1917 matches . forEach ( ( match ) => {
2018 const begin = match . index ;
2119 const end = begin + match [ 0 ] . length ;
22- if ( match . groups ?. syntax != undefined ) {
20+ if ( match [ 1 ] . startsWith ( "s:" ) ) {
2321 line . addAnnotation (
2422 new InlineStyleAnnotation ( {
2523 inlineRange : {
@@ -31,7 +29,7 @@ export function pluginCxxMark(): ExpressiveCodePlugin {
3129 } )
3230 ) ;
3331 line . editText ( begin , end , match [ 0 ] . slice ( 5 , - 2 ) ) ;
34- } else if ( match . groups ?. exposition != undefined ) {
32+ } else if ( match [ 1 ] . startsWith ( "expos:" ) ) {
3533 line . addAnnotation (
3634 new InlineStyleAnnotation ( {
3735 inlineRange : {
@@ -43,7 +41,7 @@ export function pluginCxxMark(): ExpressiveCodePlugin {
4341 } )
4442 ) ;
4543 line . editText ( begin + 2 , begin + 9 , "" ) ;
46- } else if ( match . groups ?. optional != undefined ) {
44+ } else if ( match [ 1 ] == "opt" ) {
4745 const new_str = "(optional)" ;
4846 line . editText ( begin , end , new_str ) ;
4947 line . addAnnotation (
0 commit comments