@@ -43,11 +43,23 @@ public DocumentationGroup? Parent
4343 public string ? UrlPathPrefix { get ; }
4444 private MarkdownParser MarkdownParser { get ; }
4545 public YamlFrontMatter ? YamlFrontMatter { get ; private set ; }
46+
47+ public string ? TitleRaw
48+ {
49+ get => _titleRaw ;
50+ private set
51+ {
52+ Title = value ? . StripMarkdown ( ) ;
53+ _titleRaw = value ;
54+ }
55+ }
56+
4657 public string ? Title { get ; private set ; }
58+
4759 public string ? NavigationTitle
4860 {
4961 get => ! string . IsNullOrEmpty ( _navigationTitle ) ? _navigationTitle : Title ;
50- private set => _navigationTitle = value != null ? Helpers . Markdown . StripMarkdown ( value ) : null ;
62+ private set => _navigationTitle = value ? . StripMarkdown ( ) ;
5163 }
5264
5365 //indexed by slug
@@ -65,6 +77,7 @@ public string? NavigationTitle
6577
6678 private bool _instructionsParsed ;
6779 private DocumentationGroup ? _parent ;
80+ private string ? _titleRaw ;
6881
6982 public MarkdownFile [ ] YieldParents ( )
7083 {
@@ -98,7 +111,7 @@ public async Task<MarkdownDocument> ParseFullAsync(Cancel ctx)
98111 private void ReadDocumentInstructions ( MarkdownDocument document )
99112 {
100113
101- Title = document
114+ TitleRaw = document
102115 . FirstOrDefault ( block => block is HeadingBlock { Level : 1 } ) ?
103116 . GetData ( "header" ) as string ;
104117
@@ -113,14 +126,14 @@ private void ReadDocumentInstructions(MarkdownDocument document)
113126 {
114127 Collector . EmitWarning ( FilePath , "'title' is no longer supported in yaml frontmatter please use a level 1 header instead." ) ;
115128 // TODO remove fallback once migration is over and we fully deprecate front matter titles
116- if ( string . IsNullOrEmpty ( Title ) )
117- Title = deprecatedTitle ;
129+ if ( string . IsNullOrEmpty ( TitleRaw ) )
130+ TitleRaw = deprecatedTitle ;
118131 }
119132
120133
121134 // set title on yaml front matter manually.
122135 // frontmatter gets passed around as page information throughout
123- YamlFrontMatter . Title = Title ;
136+ YamlFrontMatter . Title = TitleRaw ;
124137
125138 NavigationTitle = YamlFrontMatter . NavigationTitle ;
126139 if ( ! string . IsNullOrEmpty ( NavigationTitle ) )
@@ -143,11 +156,11 @@ private void ReadDocumentInstructions(MarkdownDocument document)
143156 }
144157 }
145158 else
146- YamlFrontMatter = new YamlFrontMatter { Title = Title } ;
159+ YamlFrontMatter = new YamlFrontMatter { Title = TitleRaw } ;
147160
148- if ( string . IsNullOrEmpty ( Title ) )
161+ if ( string . IsNullOrEmpty ( TitleRaw ) )
149162 {
150- Title = RelativePath ;
163+ TitleRaw = RelativePath ;
151164 Collector . EmitWarning ( FilePath , "Document has no title, using file name as title." ) ;
152165 }
153166
@@ -159,7 +172,7 @@ private void ReadDocumentInstructions(MarkdownDocument document)
159172 . Select ( h => ( h . GetData ( "header" ) as string , h . GetData ( "anchor" ) as string ) )
160173 . Select ( h => new PageTocItem
161174 {
162- Heading = Helpers . Markdown . StripMarkdown ( h . Item1 ! ) ,
175+ Heading = h . Item1 ! . StripMarkdown ( ) ,
163176 Slug = _slugHelper . GenerateSlug ( h . Item2 ?? h . Item1 )
164177 } )
165178 . ToList ( ) ;
0 commit comments