File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1- namespace Elastic . Markdown . Helpers ;
1+ // Licensed to Elasticsearch B.V under one or more agreements.
2+ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+ // See the LICENSE file in the project root for more information
24
3- public static class TitleSanitizer
5+ namespace Elastic . Markdown . Helpers ;
6+ public static class TitleNormalizer
47{
5- // Removes markdown formatting from the title and returns only the text
6- // Currently, only support 'bold' and 'code' formatting
7- public static string Sanitize ( string title ) => title . Replace ( "`" , "" ) . Replace ( "*" , "" ) ;
8+ // Removes markdown formatting from the title and returns only the text
9+ // Currently, only support 'bold' and 'code' formatting
10+ public static string Normalize ( string title ) => title . Replace ( "`" , "" ) . Replace ( "*" , "" ) ;
811}
Original file line number Diff line number Diff line change @@ -46,9 +46,10 @@ public DocumentationGroup? Parent
4646 public string ? Title { get ; private set ; }
4747 public string ? NavigationTitle
4848 {
49- get {
49+ get
50+ {
5051 var title = ! string . IsNullOrEmpty ( _navigationTitle ) ? _navigationTitle : Title ;
51- return string . IsNullOrEmpty ( title ) ? null : TitleSanitizer . Sanitize ( title ) ;
52+ return string . IsNullOrEmpty ( title ) ? null : TitleNormalizer . Normalize ( title ) ;
5253 }
5354 private set => _navigationTitle = value ;
5455 }
@@ -162,7 +163,7 @@ private void ReadDocumentInstructions(MarkdownDocument document)
162163 . Select ( h => ( h . GetData ( "header" ) as string , h . GetData ( "anchor" ) as string ) )
163164 . Select ( h => new PageTocItem
164165 {
165- Heading = TitleSanitizer . Sanitize ( h . Item1 ! ) ,
166+ Heading = TitleNormalizer . Normalize ( h . Item1 ! ) ,
166167 Slug = _slugHelper . GenerateSlug ( h . Item2 ?? h . Item1 )
167168 } )
168169 . ToList ( ) ;
Original file line number Diff line number Diff line change 1717 };
1818}
1919<section id =" elastic-docs-v3" >
20- @( new HtmlString (Markdown .ToHtml (" # " + Model .Title )))
20+ < h1 > @( new HtmlString (Markdown .ToHtml (" #" + Model .Title ))) </ h1 >
2121 @if (Model .Applies is not null )
2222 {
2323 await RenderPartialAsync (Applies .Create (Model .Applies ));
You can’t perform that action at this time.
0 commit comments