hyogen-md

0.10.0

Paths and Security

.doc_root marker

Place an empty file named .doc_root at your project root. The library walks up from the entry file to find it.

With .doc_rootWithout .doc_root
Reads restricted to rootDirRelative paths only
Root-relative paths allowed (/partials/x.md)Root-relative paths error
Absolute paths allowed if resolved path stays inside rootDirAbsolute paths effectively error

Symlinks are followed on Node, but the resolved target must stay inside rootDir.

Relative paths

./ and ../ work. Without .doc_root, ../ is not restricted — your loader and file layout are responsible for safety.

Remote paths (Node)

https://… URLs are allowed for include and component on Node. The default createNodeLoader fetches them.

Browser

  • Loader is required — the library does not fetch files
  • Cross-origin loading is not supported

Underscore partials

Files or directories starting with _ are excluded from SSG entry discovery (like Sass partials):

content/
  index.md          ← build entry
  _partials/
    header.md       ← not an entry, but includable

Explicitly listing a _ path in build({ input }) overrides the filter. Set includeUnderscoreEntries: true to include all matches.

Expression security

Forbidden property access

Accessing these keys throws forbidden_property_access:

  • __proto__
  • prototype
  • constructor
  • __defineGetter__

No arbitrary code

Expressions are parsed and evaluated against a whitelist — no eval, import, or host JS execution.

XSS and output

TopicBehavior
{{ }} outputNot escaped — raw interpolation
{{{ }}}Same as {{ }} today
Context sanitizationNone — suspicious values trigger suspicious_context_value warnings only
HTML safetyResponsibility of your MD→HTML pipeline

Suspicious context patterns

Values containing script tags, event handlers, javascript: URLs, embed tags, or meta refresh may warn. The value is not modified.

Secrets

DoDon't
Pass secrets via serverContext on renderServer / buildPut secrets in front matter
Use renderClient only with public dataPass serverContext to renderClient

Resource limits

LimitBehavior
Front matter size64 KB max — error
if / each nesting20 levels — warning, block skipped
Circular includesWarning, reference skipped
File expansion depthNo hard limit