From 22d9ee2eeec3b434c2a5d1d106ca73890e7f08a9 Mon Sep 17 00:00:00 2001 From: ruinivist Date: Sun, 21 Jun 2026 16:30:15 +0000 Subject: [PATCH] docs: add markdown preview --- content/docs/how-it-looks.md | 76 ++++++++++++++++++++ hugo.toml | 13 ++++ themes/starless/layouts/_default/baseof.html | 3 + 3 files changed, 92 insertions(+) create mode 100644 content/docs/how-it-looks.md diff --git a/content/docs/how-it-looks.md b/content/docs/how-it-looks.md new file mode 100644 index 0000000..d69f6fe --- /dev/null +++ b/content/docs/how-it-looks.md @@ -0,0 +1,76 @@ ++++ +title = "How it looks?" +summary = "A quick page for checking common Markdown rendering." +weight = 14 +math = true ++++ + +Use this page as a glance test for the Markdown pieces that show up most often. + +## Text + +Plain text can include **bold**, *italic*, `inline code`, and [links](https://gohugo.io/). + +> A blockquote should stand apart from the surrounding text without needing extra layout. + +## Code + +```js +const total = [2, 3, 5].reduce((sum, value) => sum + value, 0); +console.log(total); +``` + +```toml +[params] +description = "Small on purpose." +``` + +## Math + +Inline math: \(e^{i\pi} + 1 = 0\). + +Block math: + +$$ +\int_0^1 x^2\,dx = \frac{1}{3} +$$ + +Aligned equations: + +$$ +\begin{aligned} +a^2 + b^2 &= c^2 \\ +x &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} +\end{aligned} +$$ + +## Table + +| Feature | Markdown | Render check | +| --- | --- | --- | +| Inline code | `` `value` `` | `value` | +| Strong text | `**bold**` | **bold** | +| Emphasis | `*italic*` | *italic* | + +## Lists + +1. First ordered item +2. Second ordered item +3. Third ordered item + +- Unordered item +- Another unordered item +- Nested detail: + - Child item + - Another child item + +- [x] Task item done +- [ ] Task item open + +## Rule + +Text before the rule. + +--- + +Text after the rule. diff --git a/hugo.toml b/hugo.toml index 5c03a0c..686fff2 100644 --- a/hugo.toml +++ b/hugo.toml @@ -8,6 +8,13 @@ disableHugoGeneratorInject = true [outputs] home = ["HTML", "RSS", "JSON"] +[markup.goldmark.extensions.passthrough] +enable = true + +[markup.goldmark.extensions.passthrough.delimiters] +block = [["$$", "$$"]] +inline = [["\\(", "\\)"]] + [params] description = "Starless is a small Hugo theme for dark, text first sites." sidebarFooter = "Built with Hugo." @@ -35,3 +42,9 @@ name = "Files" pageRef = "/docs/files" parent = "Guide" weight = 13 + +[[menus.main]] +name = "How it looks?" +pageRef = "/docs/how-it-looks" +parent = "Guide" +weight = 14 diff --git a/themes/starless/layouts/_default/baseof.html b/themes/starless/layouts/_default/baseof.html index 72ad318..06bb7f5 100644 --- a/themes/starless/layouts/_default/baseof.html +++ b/themes/starless/layouts/_default/baseof.html @@ -11,6 +11,9 @@ + {{ if .Params.math }} + + {{ end }}