Skip to content

Commit ec3c10c

Browse files
committed
Use renderer
1 parent 86e7110 commit ec3c10c

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/Elastic.Markdown/Myst/Directives/Stepper/StepView.cshtml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@
66
{
77
case 1:
88
<h1 id="@Model.Anchor">
9-
<a href="#@Model.Anchor">@Model.Title</a>
9+
<a href="#@Model.Anchor">@Model.RenderTitle()</a>
1010
</h1>
1111
break;
1212
case 2:
1313
<h2 id="@Model.Anchor">
14-
<a href="#@Model.Anchor">@Model.Title</a>
14+
<a href="#@Model.Anchor">@Model.RenderTitle()</a>
1515
</h2>
1616
break;
1717
case 3:
1818
<h3 id="@Model.Anchor">
19-
<a href="#@Model.Anchor">@Model.Title</a>
19+
<a href="#@Model.Anchor">@Model.RenderTitle()</a>
2020
</h3>
2121
break;
2222
case 4:
2323
<h4 id="@Model.Anchor">
24-
<a href="#@Model.Anchor">@Model.Title</a>
24+
<a href="#@Model.Anchor">@Model.RenderTitle()</a>
2525
</h4>
2626
break;
2727
case 5:
2828
<h5 id="@Model.Anchor">
29-
<a href="#@Model.Anchor">@Model.Title</a>
29+
<a href="#@Model.Anchor">@Model.RenderTitle()</a>
3030
</h5>
3131
break;
3232
default:
3333
<h6 id="@Model.Anchor">
34-
<a href="#@Model.Anchor">@Model.Title</a>
34+
<a href="#@Model.Anchor">@Model.RenderTitle()</a>
3535
</h6>
3636
break;
3737
}

src/Elastic.Markdown/Myst/Directives/Stepper/StepViewModel.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using Microsoft.AspNetCore.Html;
6+
57
namespace Elastic.Markdown.Myst.Directives.Stepper;
68

79
public class StepViewModel : DirectiveViewModel
810
{
911
public required string Title { get; init; }
1012
public required string Anchor { get; init; }
1113
public required int HeadingLevel { get; init; }
14+
15+
/// <summary>
16+
/// Renders the title with substitutions applied
17+
/// </summary>
18+
public HtmlString RenderTitle()
19+
{
20+
// For now, just return the title as-is since substitutions are already applied in FinalizeAndValidate
21+
// In the future, this could be extended to handle full markdown processing
22+
return new HtmlString(Title);
23+
}
1224
}

0 commit comments

Comments
 (0)