hugo-to-markdown
Skill2 starsChanged 7 days agoApache-2.0View on GitHub
Convert Hugo documentation sites and Hugo-managed content into standard Markdown. Use when Agent needs to inspect a local Hugo repository, read hugo.toml or config files, content/, archetypes/, layouts/_shortcodes/, layouts/_markup/, and related docs content, then produce Markdown output with Hugo front matter, shortcodes, render hooks, Markdown attributes, ref/relref links, includes, page bundles, page resources, and asset paths resolved or downgraded safely. This skill is especially useful for Hugo docs migrations, Hugo-to-Markdown exports, and repository-specific conversions where the local Hugo configuration, embedded shortcode rules, and custom templates define the true rules.
- Installs packages
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- database-designSkill
- drizzle-migration-conflictSkill
- git-stackSkill
- grillSkill
- postgresql-cliSkill
- prdSkill
- pre-release-reviewSkill
- rclone-cliSkill
- redis-cliSkill
- to-specSkill
- to-taskSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
34 rules. About 0 are common, 25 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈25
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Use this skill when Markdown output must be derived from the local Hugo site, not guessed from generic Hugo knowledge.
- Distinctive: line 23
Keep plain Markdown and YAML front matter.
- Distinctive: line 26
Prefer explicit Markdown text over live Hugo template syntax.
- Distinctive: line 31
Treat the repository's own Hugo configuration and templates as the primary ruleset.
- Distinctive: line 42
Do not assume built-in Hugo defaults if the repository overrides them locally.
- Distinctive: line 48
Always inspect the site-level rules first.
- Very specific: line 72
Read references/conversion-workflow.md before changing files.
- Distinctive: line 75
Read archetypes to understand expected front matter shape.
- Distinctive: line 76
Read the front matter configuration to understand date aliases, fallback order, filename-derived dates, and other inferred metadata.
- Very specific: line 77
Read site data sources in data/ when shortcodes or partials pull structured content from them.
- Very specific: line 78
Read custom shortcode templates in layouts/_shortcodes/ or layouts/shortcodes/.
- Very specific: line 80
Read render hooks in layouts/_markup/.
- Distinctive: line 81
Check whether the repo already defines Markdown- or JSON-facing export templates and partials.
- Very specific: line 82
Follow include-style shortcodes into referenced content files when the docs site composes content from shared fragments.
- Distinctive: line 87
Use these rules by default:
- Distinctive: line 89
Keep YAML front matter unless the user explicitly asks for front-matter-free Markdown.
- Distinctive: line 98
Leave literal Hugo examples unchanged when the document is documenting Hugo syntax rather than invoking it.
- Very specific: line 112
if the repo has data-backed or example-extraction shortcodes such as features-table, optional-features-table, clients-example, or …
- Very specific: line 121
Read references/shortcodes-and-render-hooks.md before converting any file that contains Hugo syntax.
- Distinctive: line 125
After conversion, scan the generated Markdown for leftover Hugo-only syntax.
- Distinctive: line 132
If the validator reports active Hugo syntax outside code fences, either:
- Very specific: line 137
Do not silently ship unresolved {{< ...
- Distinctive: line 141
If a shortcode depends on build-time data, generated examples, or external source files that you cannot resolve deterministically from the …
- Distinctive: line 143
Use a short, boring format such as:
- Distinctive: line 148
Do not leave empty links, broken table cells, or stripped content with no explanation.
- Distinctive: line 152
Use these facts when converting a Hugo documentation site that exhibits similar patterns:
- Distinctive: line 166
Never execute Hugo templates, shortcodes, or Go template expressions.
- Distinctive: line 167
Never treat content files as trusted executable input.
- Very specific: line 168
Never run hugo, npm install, go install, downloaded shell installers, or any network install step unless the user explicitly asks for it.
- Distinctive: line 169
Keep all conversion scripts offline and deterministic.
- Distinctive: line 172
Do not leak local absolute paths, secrets, environment variables, or git credentials into generated Markdown.
- Distinctive: line 173
When exact rendering cannot be reproduced safely, degrade to explicit Markdown text instead of live Hugo syntax.
- Distinctive: line 177
Read these files as needed:
- Distinctive: line 188
Use these scripts when helpful:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hugo To Markdown
Overview
Use this skill when Markdown output must be derived from the local Hugo site, not guessed from generic Hugo knowledge. The conversion rules are the combination of Hugo's official behavior and the repository's own configuration, shortcode templates, render hooks, archetypes, and content conventions.
The target output is standard Markdown:
- Keep plain Markdown and YAML front matter.
- Replace or materialize Hugo-only constructs.
- Preserve meaning when exact rendering is not safely reproducible.
- Prefer explicit Markdown text over live Hugo template syntax.
- Distinguish literal Hugo syntax examples from active Hugo features before rewriting anything.
Official Basis
Treat the repository's own Hugo configuration and templates as the primary ruleset. For any site under conversion, inspect these rule sources in the user's provided site root:
hugo.toml(orhugo.yaml,hugo.yml,hugo.json, orconfig/*)archetypes/*data/*layouts/_shortcodes/*orlayouts/shortcodes/*layouts/_markup/*content/**
Also read any local docs that define shortcode, front matter, bundle, resource, and render-hook behavior.
Do not assume built-in Hugo defaults if the repository overrides them locally.
Workflow
1. Inventory the site before converting files
Always inspect the site-level rules first.
python3 scripts/inventory_hugo_rules.py --site-root /path/to/hugo-siteExample invocation for the user's site:
python3 skills/hugo-to-markdown/scripts/inventory_hugo_rules.py \
--site-root /path/to/your-hugo-siteThis inventory step is mandatory for batch work. It identifies:
- active config files
- module mounts and content roots
- custom shortcodes
- custom render hooks
- front matter keys seen in content
- shortcode usage across content files
2. Convert with repository rules, not generic heuristics
Read references/conversion-workflow.md before changing files. Then:
- Resolve the real content root from
hugo.toml,config.*, and module mounts. - Read archetypes to understand expected front matter shape.
- Read the front matter configuration to understand date aliases, fallback order, filename-derived dates, and other inferred metadata.
- Read site data sources in
data/when shortcodes or partials pull structured content from them. - Read custom shortcode templates in
layouts/_shortcodes/orlayouts/shortcodes/. - Classify each encountered shortcode as embedded, custom, or inline, then check whether it uses named or positional arguments, block syntax, or self-closing syntax.
- Read render hooks in
layouts/_markup/. - Check whether the repo already defines Markdown- or JSON-facing export templates and partials; if it does, use those as evidence for how the site itself downgrades Hugo constructs.
- Follow
include-style shortcodes into referenced content files when the docs site composes content from shared fragments. - Convert one file or one coherent section at a time.
3. Preserve semantics during conversion
Use these rules by default:
- Keep YAML front matter unless the user explicitly asks for front-matter-free Markdown.
- Preserve core fields such as
title,description,date,draft,aliases,slug,url,weight, and nestedparamswhen they still carry meaning. - Preserve
publishDate,lastmod,expiryDate, and page resource metadata when they still affect meaning or downstream routing. - Normalize reserved Hugo front matter keys to their canonical names when the repo mixes casing, for example
Titletotitle,Descriptiontodescription, andLinkTitletolinkTitle. - Account for Hugo front matter aliases and tokens before deciding a field is unused. The official Hugo docs recognize aliases such as
pubdate,published,modified, andunpublishdate, plus tokens such as:default,:filename,:fileModTime, and:git. - Convert Hugo internal links to normal Markdown links with resolved destinations.
- Replace Hugo shortcodes with plain Markdown, HTML, or explicit notes only after reading the local shortcode implementation.
- Preserve or materialize shortcode arguments according to the shortcode's real calling convention. Do not assume every shortcode is named-argument, self-closing, or block-capable.
- Materialize dynamically generated lists and tables when the shortcode renders content from sections or data files.
- Leave literal Hugo examples unchanged when the document is documenting Hugo syntax rather than invoking it. This applies both inside fenced code blocks and to escaped forms such as
{{</* foo */>}}or{{%/* foo */%}}that appear in prose, tables, or notation examples. - Preserve block attribute semantics such as
{.class #id}and code-fence attributes when the destination Markdown flavor supports them. If not, downgrade explicitly instead of silently dropping them.
4. Apply Hugo-specific body rules carefully
Many Hugo documentation sites use complex local behaviors. Be alert for these common patterns:
hugo.tomlmountscontent/ento the logicalcontentroot, so link and include resolution must use Hugo logical paths instead of preserving/en/blindly.- The docs basis depends on Hugo front matter configuration for date resolution, aliases, and filename-derived metadata; read
configuration/front-matter.mdand[frontmatter]inhugo.tomlbefore normalizing dates or slugs. includerenders another page throughRenderShortcodes; follow the referenced content file and inline the resulting Markdown.quick-reference,render-list-of-pages-in-section, andrender-table-of-pages-in-sectiongenerate navigation content from sections; replace them with materialized Markdown lists or tables.glossary-term,glossary,get-page-desc,module-mounts-note,new-in, anddeprecated-inexpand to prose or badges; convert them into explicit Markdown text or callouts.code-togglemay read config snippets and data-backed examples; preserve the underlying code sample, not the UI toggle.datatable,per-lang-config-keys,root-configuration-keys,syntax-highlighting-styles,chroma-lexers,newtemplatesystem, andhlare also local shortcodes; inspect their implementations before deciding whether to materialize, flatten, or downgrade.- if the repo has data-backed or example-extraction shortcodes such as
features-table,optional-features-table,clients-example, orjupyter-example, inspect the referenceddata/files, local example sources, and Markdown-export partials before deciding whether to materialize or downgrade. - glossary links can use the special Markdown destination
(g); resolve these to stable glossary links instead of leaving the placeholder. imgandimgprocare presentation helpers around page, global, or remote resources; preserve the underlying image reference and caption semantics.eturlemits links to embedded template sources; convert to a normal Markdown link if the destination is known, otherwise preserve as a textual note.- the local link render hook resolves destinations in this order: content page, page resource, section resource when the page is not a leaf bundle, then global resource. It also validates fragments and glossary shorthand.
- blockquote and code-block render hooks add alert, file-label, summary, and detail semantics; preserve these semantics in Markdown or explicit notes.
- embedded
refandrelrefare obsolete for Markdown in modern Hugo docs and can interact poorly with the custom link render hook; resolve the final destination instead of preserving the shortcode. - the local docs use Markdown attributes and code-fence options that can change rendered output. Keep these semantics when the destination flavor supports them.
Read references/shortcodes-and-render-hooks.md before converting any file that contains Hugo syntax.
5. Validate the output
After conversion, scan the generated Markdown for leftover Hugo-only syntax.
python3 skills/hugo-to-markdown/scripts/check_standard_markdown.py \
--root /path/to/outputIf the validator reports active Hugo syntax outside code fences, either:
- resolve it fully, or
- replace it with a safe textual explanation
Do not silently ship unresolved {{< ... >}}, {{% ... %}}, or Go template expressions.
6. Downgrade explicitly when full materialization is not safe
If a shortcode depends on build-time data, generated examples, or external source files that you cannot resolve deterministically from the local repo snapshot, replace it with an explicit Markdown note.
Use a short, boring format such as:
> Conversion note: <what the shortcode normally renders>.- followed by any safe subset you were able to preserve, such as inline Redis CLI text, a resolved image URL, or a known section list
Do not leave empty links, broken table cells, or stripped content with no explanation.
Common Hugo Docs Site Patterns
Use these facts when converting a Hugo documentation site that exhibits similar patterns:
hugo.tomlmountscontent/entocontent, so English docs are the active content tree.- Goldmark passthrough delimiters are configured for math, so
$$...$$,\\(...\\), and\\[...\\]can be meaningful content, not junk. markup.goldmark.parser.attribute.block = true, so block attribute syntax may appear after fenced blocks and other block elements.markup.goldmark.parser.wrapStandAloneImageWithinParagraph = false, so standalone image attributes can target the image itself rather than a wrapping paragraph.- The repo defines custom render hooks for blockquotes, code blocks, links, passthrough, and tables. It documents heading and image render hooks, but the site does not override them locally.
- The repo uses many shared
_commonfragments referenced through% include %, so reading a page file alone is not enough to understand the rendered content. - The repo documents embedded, custom, and inline shortcodes, and the conversion logic must distinguish them before flattening syntax.
- The repo uses page bundles and page resources heavily in examples and render-hook resolution, including section resources and mounted global resources.
- The repo contains many escaped shortcode examples such as
{{</* foo */>}}and{{%/* foo */%}}; these are documentation samples and must remain literal when they appear inside code examples, notation tables, or tutorial prose.
Safety Rules
- Never execute Hugo templates, shortcodes, or Go template expressions.
- Never treat content files as trusted executable input.
- Never run
hugo,npm install,go install, downloaded shell installers, or any network install step unless the user explicitly asks for it. - Keep all conversion scripts offline and deterministic.
- Restrict reads to the declared site root and writes to the declared output root.
- Reject path traversal, symlink escape, or attempts to write outside the requested output directory.
- Do not leak local absolute paths, secrets, environment variables, or git credentials into generated Markdown.
- When exact rendering cannot be reproduced safely, degrade to explicit Markdown text instead of live Hugo syntax.
Resources
Read these files as needed:
references/conversion-workflow.mdEnd-to-end process for repo-aware conversion.references/front-matter-and-content.mdFront matter mapping, common content conventions, and literal-example handling.references/shortcodes-and-render-hooks.mdHugo shortcode notation, docs-site custom shortcodes, and render-hook implications.references/links-assets-and-validation.mdLink resolution, assets, validation, and residue triage.
Use these scripts when helpful:
scripts/inventory_hugo_rules.pyScan a Hugo site and emit a rule inventory.scripts/check_standard_markdown.pyDetect leftover Hugo syntax and common unsafe residue in Markdown output.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

