@@ -20,19 +20,23 @@ public class StepViewModel : DirectiveViewModel
2020 /// </summary>
2121 public HtmlString RenderTitle ( )
2222 {
23- // Parse the title as markdown inline content
24- var document = Markdig . Markdown . Parse ( Title , MarkdownParser . Pipeline ) ;
25- var firstBlock = document . FirstOrDefault ( ) as Markdig . Syntax . ParagraphBlock ;
26- var inline = firstBlock ? . Inline ;
23+ // Apply substitutions first, then parse with Markdig
24+ var directiveBlock = ( DirectiveBlock ) DirectiveBlock ;
25+ var span = Title . AsSpan ( ) ;
26+ var processedTitle = span . ReplaceSubstitutions ( directiveBlock . Build . Configuration . Substitutions , directiveBlock . Build . Collector , out var replacement )
27+ ? replacement : Title ;
2728
28- if ( firstBlock == null )
29- return new ( Title ) ;
29+ // Parse the processed title as markdown inline content
30+ var document = Markdig . Markdown . Parse ( processedTitle , MarkdownParser . Pipeline ) ;
31+
32+ if ( document . FirstOrDefault ( ) is not Markdig . Syntax . ParagraphBlock firstBlock )
33+ return new ( processedTitle ) ;
3034
3135 // Use the HTML renderer to render the inline content with full processing
3236 var subscription = DocumentationObjectPoolProvider . HtmlRendererPool . Get ( ) ;
3337 _ = subscription . HtmlRenderer . WriteLeafInline ( firstBlock ) ;
3438
35- var result = subscription . RentedStringBuilder ? . ToString ( ) ?? Title ;
39+ var result = subscription . RentedStringBuilder ? . ToString ( ) ?? processedTitle ;
3640 DocumentationObjectPoolProvider . HtmlRendererPool . Return ( subscription ) ;
3741 return new ( result ) ;
3842 }
0 commit comments