@@ -33,13 +33,15 @@ public class RenderScriban : ParallelModule
3333 private MemberRenamerDelegate _renamer ;
3434 private ParserOptions _parserOptions ;
3535 private LexerOptions _lexerOptions ;
36+ private bool _liquid ;
3637
3738 /// <summary>
3839 /// Parses Scriban templates in each input document and outputs documents with rendered content.
3940 /// </summary>
4041 public RenderScriban ( )
4142 {
4243 _lexerOptions = LexerOptions . Default ;
44+ _liquid = false ;
4345 }
4446
4547 /// <summary>
@@ -102,6 +104,17 @@ public RenderScriban WithLexerOptions(LexerOptions lexerOptions)
102104 return this ;
103105 }
104106
107+ /// <summary>
108+ /// Specifies that templates should be treated as Liquid templates instead of Scriban.
109+ /// Short for doing <c>WithLexerOptions(new LexerOptions { Mode = ScriptMode.Liquid })</c>.
110+ /// </summary>
111+ /// <returns>The current module instance.</returns>
112+ public RenderScriban AsLiquid ( )
113+ {
114+ _liquid = true ;
115+ return this ;
116+ }
117+
105118 /// <inheritdoc />
106119 protected override async Task < IEnumerable < IDocument > > ExecuteInputAsync ( IDocument input , IExecutionContext context )
107120 {
@@ -127,7 +140,9 @@ protected override async Task<IEnumerable<IDocument>> ExecuteInputAsync(IDocumen
127140
128141 _renamer ??= StandardMemberRenamer . Default ;
129142
130- Template template = Template . Parse ( content , input . Source . FullPath , _parserOptions , _lexerOptions ) ;
143+ Template template = _liquid
144+ ? Template . ParseLiquid ( content , input . Source . FullPath , _parserOptions , _lexerOptions )
145+ : Template . Parse ( content , input . Source . FullPath , _parserOptions , _lexerOptions ) ;
131146
132147 if ( template . HasErrors )
133148 {
0 commit comments