@@ -2,7 +2,7 @@ import pkg from "./package.json" with { type: "json" };
22import Prism from "prismjs" ;
33import PrismLoader from "./src/PrismLoader.js" ;
44import hasTemplateFormat from "./src/hasTemplateFormat.js" ;
5- import HighlightPairedShortcode from "./src/HighlightPairedShortcode.js" ;
5+ import highlightCode from "./src/HighlightPairedShortcode.js" ;
66
77const TRIPLE_BACKTICK = "```" ;
88
@@ -38,7 +38,7 @@ ${content}
3838${ TRIPLE_BACKTICK } \n\n`;
3939 }
4040
41- return HighlightPairedShortcode ( content , language , highlightNumbers . join ( " " ) , options ) ;
41+ return highlightCode ( content , language , highlightNumbers . join ( " " ) , options ) ;
4242 }
4343
4444 if ( hasTemplateFormat ( options . templateFormats , "liquid" ) ) {
@@ -55,7 +55,7 @@ ${TRIPLE_BACKTICK}\n\n`;
5555 highlight : function ( content , rawLanguage ) {
5656 // ```js/0,2-3
5757 let [ language , ...highlightNumbers ] = ( rawLanguage || "" ) . split ( "/" ) ;
58- return HighlightPairedShortcode ( content , language , highlightNumbers . join ( " " ) , options ) ;
58+ return highlightCode ( content , language , highlightNumbers . join ( " " ) , options ) ;
5959 }
6060 } )
6161 } ) ;
@@ -64,10 +64,11 @@ ${TRIPLE_BACKTICK}\n\n`;
6464 // we need to add this as many template languages (WebC) rely on JavaScript functions (not just 11ty.js)
6565 // Note the argument order for language, content (differs from shortcode)
6666 eleventyConfig . addJavaScriptFunction ( "highlight" , ( language , content , ...highlightLines ) => {
67- return HighlightPairedShortcode ( content , language , ( highlightLines || [ ] ) . join ( " " ) , options ) ;
67+ return highlightCode ( content , language , ( highlightLines || [ ] ) . join ( " " ) , options ) ;
6868 } ) ;
6969
7070 options . init ( { Prism} )
7171} ;
7272
73- export { HighlightPairedShortcode as pairedShortcode } ;
73+ export { highlightCode as pairedShortcode } ;
74+ export { highlightCode as highlight } ;
0 commit comments