On this page
The short answerWhat Hexo publishesWhy examples on Hexo sites break or go untestedBuild a small site and inspect its sourceSee what the source scan collectsMake a scan-ready copyTriage and maintain the coverageWhere DocsAlive fitsThe sources we checkedFAQThe short answer
Test Hexo examples at both the source and rendered-page boundaries. Build the site to see what Hexo publishes, then run the examples readers can copy, including code inserted by tag plugins. In engine 0.6.3, DocsAlive does not detect Hexo: it treats this project as plain Markdown and, without a top-level docs/ folder, scans from the repository root. It scans drafts and scaffolds, never sees code supplied only through tag plugins, and runs supported JavaScript with Node without comparing its output.
A reliable check needs an explicit inventory of the pages and examples that matter. Hexo can assemble a page from a post and separate files, while a source scan reads the text it finds without rendering the site. A successful build therefore establishes that Hexo generated pages under its rules; it does not establish that every example on those pages runs.
The walkthrough below uses Hexo 8.1.2 and engine 0.6.3. It starts with a small illustrative site, shows the coverage gap, and then creates a scan-ready copy. The copy is a practical aid for this particular layout, with limits that should remain visible in your CI review. For the broader workflow, see static-site docs testing and testing JavaScript documentation.
What Hexo publishes
Hexo puts new posts in source/_posts and pages in source. Drafts live in source/_drafts and are not displayed by default. The --draft option or render_drafts setting renders them; publishing a draft moves it to _posts. A draft can be worth testing before publication, but a report should distinguish it from a currently published post.
Inside source, Hexo ignores hidden files and files or folders whose names start with an underscore, except _posts. Renderable files, including Markdown and HTML, are processed into public; other files are copied. The skip_render setting copies matching paths raw and can also exclude a post. Scaffolds in scaffolds/ are templates for new posts, not existing published pages. Hexo also supports other post formats through renderer plugins.
That distinction matters to a source scanner. In a plain project, engine 0.6.3 collects Markdown files according to its own rules. It does not render Hexo templates or decide whether Hexo would publish a particular source file. It scans underscore folders such as _posts and _drafts, and it can collect scaffolds. If a top-level docs/ folder exists, its default scope changes to that folder plus the root README when present.
Hexo's tag plugins introduce another boundary. A codeblock tag can put code on the page without a Markdown fence in the source. Hexo documents a backtick code block as equivalent to the codeblock tag. The include_code tag inserts a file from the configured code_dir, which defaults to source/downloads/code; its options include lang, from, and to. Raw tags protect their contents from processing. Tag plugins should not be wrapped inside Markdown syntax.
These features are useful to authors, but they mean a fence-only scan can miss code that readers see. Conversely, a scan can report a problem in a draft or scaffold that is not on the built site. Treat both as findings with an identified publication status.
Why examples on Hexo sites break or go untested
Most failures on a Hexo site are not exotic. They come from the distance between the Markdown file an author edits and the page a reader copies from. Five patterns account for most of that distance.
First, code can be assembled by tags. A post can hold a codeblock tag or an include_code tag instead of a fence, so the code a reader sees is either bounded by tag lines or stored in another file. A tool that only looks for fences never sees it, and the post can look fully covered while its most important example is untested.
Second, an included file can silently render nothing. The probe below shows an include_code tag that produced no code on the built page while the build reported success. A missing example is easy to overlook in review.
Third, drafts live in the repository. A draft can sit in source/_drafts for months while the API it describes changes. A source scan will report it, which is useful before publication but misleading in a report about the live site.
Fourth, scaffolds and starter content travel with the project. Scaffolds are templates, and the starter post includes commands that create posts and start a server. Run unattended, those commands change the working tree or keep running.
Fifth, the scripts folder is not a general folder for helper scripts. Hexo loads what it finds there, so a test helper placed there becomes part of every build.
Build a small site and inspect its source
The following setup is illustrative. The starter post is removed because its shell examples include commands that create a post and start a server. When the scan driver ran those blocks on the box, the first wrote an extra post and the server continued until the run was stopped.
npx hexo-cli init hsite
cd hsite
rm source/_posts/hello-world.md
A starter post is useful onboarding material, but it is still executable content if a scanner collects it. Review commands that write files or start long-running processes before including them in an automated run. A timeout can stop a run, but it does not turn a server command into a useful short example test.
The illustrative post below contains a normal Python fence, an included JavaScript file, Python inside a codeblock tag, and an HTML fence showing a theme variable.
---
title: Install the acme client
date: 2026-11-14 10:00:00
tags: python
---
Check your Python version first.
```python
import sys
major, minor = sys.version_info[:2]
print(f"Python {major}.{minor}")
```
The Node helper lives in the downloads folder:
{% include_code connect.js lang:javascript connect.js %}
Parse a version string:
{% codeblock version.py lang:python %}
parts = "2.4.1".split(".")
print(tuple(int(p) for p in parts))
{% endcodeblock %}
A theme snippet that shows the post title:
```html
<h1>{{ page.title }}</h1>
```
The post illustrates three different relationships between source and output. The Python and HTML fences are present as fences in the Markdown source. The JavaScript is in a separate file and is brought into the post by a tag. The second Python example is present in the source, but its boundaries are tag lines rather than fences.
The included file for this example is illustrative as well:
const hosts = ["api.acme-docs-demo.test", "backup.acme-docs-demo.test"];
const first = Array.isArray(hosts) ? hosts[0] : hosts;
console.log(`connecting to ${first}`);
Keeping a sample in a separate file can make it easier to test directly. It also creates a dependency between the tag's path and the file that Hexo finds. If the file moves, or the tag does not resolve as expected, the published page can lose its example even though the source file still exists.
The next file is a draft, and its import is broken on purpose for current Python versions. It is useful for demonstrating why publication status and test status should be recorded separately.
---
title: What changes in 3.0
tags: python
---
The 3.0 client accepts any mapping:
```python
from collections import Mapping
print(issubclass(dict, Mapping))
```
The import was removed from that location in Python 3.10. A draft check can catch that issue before publication. But if the goal is a report about the currently rendered site, calling this a published-page failure would misstate its impact.
Build the illustrative site with Hexo:
npx hexo generate
The build completed successfully. The following is the recorded build output, with theme asset lines omitted:
INFO Validating config
INFO Start processing
INFO Files loaded in 172 ms
INFO Generated: 2026/11/14/install-acme/index.html
INFO 13 files generated in 153 ms
The built post showed the normal Python fence, the contents of the JavaScript include with a view-raw link, the codeblock tag's Python with its caption, and the HTML example. The theme variable remained literal inside the backtick fence. No page was built for the draft.
Inspecting the built page matters because the source alone does not establish what a reader receives. In this case, the build confirms that the two tag-provided examples appear, but it does not execute them as a reader would.
A successful build can omit an include
The following change is broken on purpose for the observed setup. A Python file was placed at the corresponding path and the tag was changed to point to it.
-{% include_code connect.js lang:javascript connect.js %}
+{% include_code connect.py lang:python connect.py %}
Hexo exited successfully without a warning or error, and copied the Python file to public/downloads/code/. The built post nevertheless contained nothing where the tag appeared. In this Hexo 8.1.2 probe, the model listed that Python file as an asset rather than a page, while the tag looked it up among pages. The JavaScript file worked. These observations apply to those tested files; they do not establish the behavior of every other file type.
A missing example can be more difficult to notice than a broken example. Add rendered-page inspection to review when a tag or included path changes, particularly when a build gives no warning. A direct test of the source file is useful, but it cannot prove that the published page actually contains it.
See what the source scan collects
This command plans a scan; the default CLI invocation does not execute examples:
docsalive scan .
In the probe, the engine treated the project as plain Markdown and scanned from the root because there was no top-level docs/ folder. It collected five pages: three scaffolds, the draft, and the post. It extracted three blocks. When run, the normal Python fence passed, the HTML fence was skipped as not executable, and the unpublished draft failed as api-drift. The included JavaScript and the Python inside the codeblock tag were never seen.
The theme was under node_modules, a folder the collector skips. The engine also skips several other named folders, including build, dist, site, snippets, and _snippets. Other hidden folders are not skipped, and folders that start with an underscore, such as _posts and _drafts, are scanned. An include filter only narrows pages already collected; it cannot bring back a page from a skipped folder.
| Hexo item | What Hexo does | What the engine does in 0.6.3 |
|---|---|---|
Post in _posts |
Renders the post when included in the build | Scans its Markdown fences if collected |
Draft in _drafts |
Does not display it by default; configured draft rendering can include it | Scans the folder and does not identify the page as a draft |
| Scaffold | Uses it as a template for new content | Can collect its Markdown as a page during a root scan |
| Codeblock tag | Renders its contents as code | Does not extract code bounded only by tag lines |
| include_code tag | Inserts the selected file content when resolved | Reads the tag as source text and does not fetch the included file |
| Raw tags | Protect content from processing | Does not render the tags before extracting fences |
| HTML fence | Displays an HTML example | Skips it as not executable |
skip_render path |
Copies the path raw or can exclude a post | Does not apply that Hexo setting |
These are different selection systems, so compare the inventory before interpreting a pass rate. A page count is a count of collected files, not proof that the same number of pages was published. Likewise, a block count cannot include tag-provided code that the extractor never encountered as a fence.
Make a scan-ready copy
The following illustrative script lives in tools/. Hexo loads JavaScript files in a top-level scripts/ folder during initialization. In the probe, putting this Python file there caused Hexo to print a script-load error while still exiting successfully.
"""Write a scan-ready copy of Hexo posts: tag-plugin code becomes plain fences."""
import re
import sys
from pathlib import Path
src, out = Path(sys.argv[1]), Path(sys.argv[2])
code_dir = src / "downloads" / "code" # Hexo's default code_dir
OPEN = re.compile(r"^\{%\s*(?:codeblock|code)\b(.*?)%\}\s*$")
CLOSE = re.compile(r"^\{%\s*(?:endcodeblock|endcode)\s*%\}\s*$")
INCLUDE = re.compile(r"^\{%\s*include_code\b(.*?)%\}\s*$")
RAW = re.compile(r"^\{%\s*(?:raw|endraw)\s*%\}\s*$")
def lang_of(args):
m = re.search(r"lang:(\w+)", args)
return m.group(1) if m else ""
def convert(text):
lines, result = text.split("\n"), []
for line in lines:
if RAW.match(line):
continue
m = INCLUDE.match(line)
if m:
args = m.group(1)
start = re.search(r"from:(\d+)", args)
end = re.search(r"to:(\d+)", args)
path = re.sub(r"(lang|from|to):\S+", "", args).split()[-1]
body = (code_dir / path).read_text().split("\n")
body = body[int(start.group(1)) - 1 if start else 0:int(end.group(1)) if end else None]
result += ["```" + lang_of(args)] + "\n".join(body).strip().split("\n") + ["```"]
continue
m = OPEN.match(line)
if m:
result.append("```" + lang_of(m.group(1)))
elif CLOSE.match(line):
result.append("```")
else:
result.append(line)
return "\n".join(result)
for page in sorted((src / "_posts").rglob("*.md")):
target = out / "posts" / page.relative_to(src / "_posts")
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(convert(page.read_text()))
print(f"wrote {target}")
The script converts codeblock and code tags to fences, expands include_code files with the selected line range, drops raw tag lines, and copies only posts. It gives the fence extractor a representation of examples that were otherwise hidden behind supported tags.
Generate the copy and plan its scan:
python3 tools/hexo_scan_copy.py source scan-docs
docsalive scan . --docs-dir scan-docs
The recorded script output was:
wrote scan-docs/posts/install-acme.md
The copy contained one page and four blocks. When run, both Python blocks passed, the included JavaScript passed under Node 24, and the HTML block was skipped. The engine's default runner uses Node for supported JavaScript; the particular probe used Node 24.
This is a targeted conversion, not a Hexo renderer. It assumes the default source folder and code_dir rather than reading _config.yml. It handles only codeblock or code, include_code, and raw tags, with one tag per line. It does not render other tags, Nunjucks, or EJS. It skips pages outside _posts, and it ignores skip_render and exclude rules.
The copy also expands an include even when Hexo itself would render nothing, as in the observed Python-file case. Compare the generated copy with the built post when in doubt. Keep scan-docs/ outside source/ and regenerate it in CI so the scan uses the current post and included files. If the selected scan directory itself contains a docs/ subfolder, engine 0.6.3 narrows collection to that subfolder; this copy avoids that layout.
Test a real runtime failure
The following change is broken on purpose. It calls a method the array does not have:
-const first = Array.isArray(hosts) ? hosts[0] : hosts;
+const first = Array.isArray(hosts) ? hosts.first() : hosts;
Hexo still built the page. When the scan-ready copy was run, the JavaScript block failed with a TypeError and was classified as runtime-error, which needs review. That result supplies evidence a reader would hit a problem; it is not automatically filed as a confirmed docs bug by that category alone.
This example also shows why a build and an execution check complement each other. The build verifies the site-generation path under the tested configuration. The run exercises the included code after conversion. Neither result proves that the conversion perfectly mirrors every rendered page.
Triage and maintain the coverage
| Finding | Likely cause | What to do |
|---|---|---|
Draft fails as api-drift |
The root scan collected an unpublished draft | Fix it before publication; distinguish it from current published coverage |
| Included code is absent from the report | The source contains a tag rather than a fence | Generate and scan a copy, then check the built page |
| Included code is absent from the page | The tag did not resolve as expected | Inspect the built post and the referenced file; do not rely on build status alone |
JavaScript fails as runtime-error |
A call or prerequisite may be wrong | Reproduce with the intended setup and decide whether the example or environment needs a change |
| HTML is skipped | The fence is not executable | Review the markup and rendered page separately |
| A run does not finish | A block started a server or another long-running process, as the starter post's server command did | Remove or rewrite that block for automated runs and test the server step separately |
| A result says pass for an unfamiliar label | The label may have no checker | Verify support before treating the result as execution evidence |
An unknown fence label can be reported as passing without being run or parsed in engine 0.6.3. Treat that as a known engine limitation. Also review setup and dependencies: --setup runs a shell command before each page, while the default scan only plans. A finding can reflect a missing tool, fixture, or context rather than a defect in the published example.
Use this checklist in a review or CI issue:
[ ] List the posts and pages included in the intended Hexo build.
[ ] Decide whether drafts are in scope and label their findings accordingly.
[ ] Review scaffolds and starter posts before a root scan.
[ ] Inventory codeblock, include_code, and raw tags used by published posts.
[ ] Build the site and inspect included examples on the generated pages.
[ ] Generate the scan-ready copy outside source and review its coverage limits.
[ ] Run supported examples with the documented setup.
[ ] Review skipped, unsupported, timeout, and runtime-error findings.
[ ] Regenerate the copy and repeat checks when posts or included files change.
Where DocsAlive fits
DocsAlive can run supported fenced examples in page order, preserve page-level state, and classify results for review. It can help distinguish likely API drift from missing tools, context, credentials, and other causes. Its findings reference explains the categories, and the CLI reference describes scan options.
For Hexo, the scan-ready copy makes some tag-provided examples visible, but it does not establish rendered-site parity. Keep the Hexo build and rendered-page review alongside the scan. Every plan runs the scan on a schedule, and the Team plan and above add pull request checks and draft fix pull requests; pricing lists what each plan includes. To see a real report on a public repository you maintain, use the health check.
The same distinction applies to other documentation systems: pdoc examples can live in docstrings, while Doxygen examples can live in comments and snippet files. Each source format needs a coverage plan before a report can be interpreted.
The sources we checked
The following sources were read on November 14, 2026. Engine behavior was checked against engine 0.6.3 on the same day.
| Source | What it covers |
|---|---|
| Hexo writing | Posts, pages, drafts, scaffolds, and renderer plugins for other formats |
| Hexo tag plugins | Codeblock, include_code, and raw tags |
| Hexo configuration | code_dir, skip_render, render_drafts, and include and exclude rules |
| Hexo setup | Folder layout, scaffolds, and the underscore rule inside source |
| Hexo plugins | Scripts in the scripts folder, loaded during initialization |
| Hexo commands | Generation and draft-related commands |
| Python 3.10 changes | Removal relevant to the draft example |
FAQ
Does DocsAlive detect Hexo?
Engine 0.6.3 does not. It treats Hexo as plain Markdown, scans from the root when there is no top-level docs folder, collects drafts and scaffolds, and does not render tag plugins. Supported JavaScript fences run with Node; their output is not compared.
Why did an included example not appear in the scan?
The engine extracts fences from source text and does not expand an include_code tag. A scan-ready copy can expose the file contents as a fence, subject to the conversion script's stated limits.
Does a successful Hexo build prove an include appeared?
No. In the observed Python-file case, the build succeeded and copied the file, but the tag rendered nothing. Inspect the built post when an include changes or its resolution is uncertain.
Should drafts be tested?
Testing drafts can catch problems before publication. Label them as drafts in triage so a failure is not mistaken for a defect on the currently published site.
Why keep the conversion script outside scripts?
Hexo loads files in its top-level scripts folder during initialization. The Python conversion script caused a script-load error there in the probe, so the walkthrough keeps it in tools.
Is the scan-ready copy the rendered site?
No. It handles only the listed tags and assumes default paths. It skips other pages and rendering rules, so compare it with the built site and maintain separate checks for anything it cannot represent.




