@@ -2,30 +2,34 @@ const Prism = require("prismjs");
22const hasTemplateFormat = require ( "./src/hasTemplateFormat" ) ;
33const HighlightPairedShortcode = require ( "./src/HighlightPairedShortcode" ) ;
44const LiquidHighlightTag = require ( "./src/LiquidHighlightTag" ) ;
5- const markdownPrismJs = require ( "./src/markdownSyntaxHighlight " ) ;
5+ const markdownPrismJs = require ( "./src/markdownSyntaxHighlightOptions " ) ;
66
77module . exports = {
88 initArguments : { Prism } ,
99 configFunction : function ( eleventyConfig , options = { } ) {
10+ options = Object . assign ( { alwaysWrapLineHighlights : false } , options ) ;
11+
1012 // TODO hbs?
1113 if ( hasTemplateFormat ( options . templateFormats , "liquid" ) ) {
1214 eleventyConfig . addLiquidTag ( "highlight" , ( liquidEngine ) => {
1315 // {% highlight js 0 2 %}
1416 let highlight = new LiquidHighlightTag ( liquidEngine ) ;
15- return highlight . getObject ( ) ;
17+ return highlight . getObject ( options ) ;
1618 } ) ;
1719 }
1820
1921 if ( hasTemplateFormat ( options . templateFormats , "njk" ) ) {
2022 eleventyConfig . addPairedNunjucksShortcode ( "highlight" , ( content , args ) => {
2123 // {% highlight "js 0 2-3" %}
2224 let [ language , ...highlightNumbers ] = args . split ( " " ) ;
23- return HighlightPairedShortcode ( content , language , highlightNumbers . join ( " " ) ) ;
25+ return HighlightPairedShortcode ( content , language , highlightNumbers . join ( " " ) , options ) ;
2426 } ) ;
2527 }
2628
2729 if ( hasTemplateFormat ( options . templateFormats , "md" ) ) {
28- eleventyConfig . addMarkdownHighlighter ( markdownPrismJs ) ;
30+ eleventyConfig . addMarkdownHighlighter ( markdownPrismJs ( options ) ) ;
2931 }
3032 }
3133} ;
34+
35+ module . exports . pairedShortcode = HighlightPairedShortcode ;
0 commit comments