|
1 | | -@using Elastic.Markdown.Helpers |
2 | 1 | @using Markdig |
3 | | -@inherits RazorSliceHttpResult<MainViewModel> |
4 | | -<div class="flex flex-col items-center px-6"> |
5 | | - <div class="container flex"> |
6 | | - @await RenderPartialAsync(_PagesNav.Create(Model)) |
7 | | - @await RenderPartialAsync(_TableOfContents.Create<ITableOfContentsModel>(Model)) |
8 | | - <main class="w-full pt-6 pb-30 px-6 order-2 relative"> |
9 | | - <div class="w-full absolute top-0 left-0 right-0 htmx-indicator" id="htmx-indicator" role="status"> |
10 | | - <div class="h-[2px] w-full overflow-hidden"> |
11 | | - <div class="progress w-full h-full bg-pink-70 left-right"></div> |
12 | | - </div> |
13 | | - <div class="sr-only">Loading</div> |
14 | | - </div> |
15 | | - <div class="content-container"> |
16 | | - @await RenderPartialAsync(_Breadcrumbs.Create<IBreadCrumbModel>(Model)) |
17 | | - </div> |
18 | | - <article id="markdown-content" class="content-container markdown-content"> |
19 | | - @* This way it's correctly rendered as <h1>text</h1> instead of <h1><p>text</p></h1> *@ |
20 | | - @(new HtmlString(Markdown.ToHtml("# " + Model.TitleRaw))) |
21 | | - @if (Model.Applies is not null) |
22 | | - { |
23 | | - await RenderPartialAsync(ApplicableTo.Create(Model.Applies)); |
24 | | - } |
25 | | - @(new HtmlString(Model.MarkdownHtml)) |
26 | | - </article> |
27 | | - <footer id="prev-next-nav" class="content-container mt-20"> |
28 | | - <div class="flex flex-wrap lg:flex-nowrap gap-2 mt-2"> |
29 | | - <div class="w-full"> |
30 | | - @if (Model.PreviousDocument != null) |
31 | | - { |
32 | | - <a |
33 | | - href="@Model.PreviousDocument.Url" |
34 | | - hx-get="@Model.PreviousDocument.Url" |
35 | | - hx-select-oob="@Htmx.GetHxSelectOob()" |
36 | | - hx-swap="none" |
37 | | - hx-push-url="true" |
38 | | - hx-indicator="#htmx-indicator" |
39 | | - preload="mouseover" |
40 | | - class="flex h-full items-center text-ink-light hover:black border-1 border-gray-300 hover:border-gray-500 rounded-lg p-6 shadow-md" |
41 | | - > |
42 | | - <svg class="size-6 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> |
43 | | - <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5 8.25 12l7.5-7.5"/> |
44 | | - </svg> |
45 | | - <div> |
46 | | - <div class="text-xs lg:text-sm">Previous</div> |
47 | | - <div class="text-base lg:text-xl text-black">@Model.PreviousDocument.NavigationTitle</div> |
48 | | - </div> |
49 | | - </a> |
50 | | - } |
51 | | - </div> |
52 | | - <div class="w-full"> |
53 | | - @if (Model.NextDocument != null) |
54 | | - { |
55 | | - <a |
56 | | - href="@Model.NextDocument.Url" |
57 | | - hx-get="@Model.NextDocument.Url" |
58 | | - hx-select-oob="@Htmx.GetHxSelectOob()" |
59 | | - hx-swap="none" |
60 | | - hx-push-url="true" |
61 | | - hx-indicator="#htmx-indicator" |
62 | | - preload="mouseover" |
63 | | - class="flex h-full items-center justify-end text-ink-light hover:black border-1 border-gray-300 hover:border-gray-500 rounded-lg p-6 shadow-md text-right" |
64 | | - > |
65 | | - <div> |
66 | | - <div class="text-xs lg:text-sm">Next</div> |
67 | | - <div class="text-base lg:text-xl text-black">@Model.NextDocument.NavigationTitle</div> |
68 | | - </div> |
69 | | - <svg class="size-6 ml-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> |
70 | | - <path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5"/> |
71 | | - </svg> |
72 | | - </a> |
73 | | - } |
74 | | - </div> |
75 | | - </div> |
76 | | - </footer> |
77 | | - </main> |
78 | | - </div> |
79 | | -</div> |
| 2 | +@inherits RazorSliceHttpResult<IndexViewModel> |
| 3 | +@implements IUsesLayout<Elastic.Markdown.Slices._Layout, LayoutViewModel> |
| 4 | +@functions { |
| 5 | + public LayoutViewModel LayoutModel => new() |
| 6 | + { |
| 7 | + Title = $"Elastic Documentation: {Model.Title}", |
| 8 | + PageTocItems = Model.PageTocItems.Where(i => i is { Level: 2 or 3 }).ToList(), |
| 9 | + CurrentDocument = Model.CurrentDocument, |
| 10 | + Previous = Model.PreviousDocument, |
| 11 | + Next = Model.NextDocument, |
| 12 | + NavigationHtml = string.Empty, |
| 13 | + UrlPathPrefix = Model.UrlPathPrefix, |
| 14 | + GithubEditUrl = Model.GithubEditUrl, |
| 15 | + AllowIndexing = Model.AllowIndexing, |
| 16 | + }; |
| 17 | +} |
| 18 | +<section id="elastic-docs-v3"> |
| 19 | + @* This way it's correctly rendered as <h1>text</h1> instead of <h1><p>text</p></h1> *@ |
| 20 | + @(new HtmlString(Markdown.ToHtml("# " + Model.TitleRaw))) |
| 21 | + @if (Model.Applies is not null) |
| 22 | + { |
| 23 | + await RenderPartialAsync(ApplicableTo.Create(Model.Applies)); |
| 24 | + } |
| 25 | + @(new HtmlString(Model.MarkdownHtml)) |
| 26 | +</section> |
0 commit comments