hyogen-md

0.10.0

Hyogen Blocks

hyogen.md logic lives inside HTML comments so Markdown previews stay clean.

Standard form

<!--
@hg
const greeting = "hello"
@endhg
-->

Variants that work equally:

<!--@hg
const x = 1
@endhg-->
<!--@hg /* one-line block */ @endhg-->

Shorthand form

@@@@ is equivalent to @hg@endhg:

<!--@@
include ./partials/header.md
@@-->
<!--@@ include ./partials/footer.md @@-->

Use /* */ for inline comments in one-line blocks (not //, which ends at newline).

What goes inside

CategoryExamples
Declarationsconst, let, reassignment
Includesinclude, component … as, extend
Control flowif / else / each (structural — wrap Markdown body)
Loopsfor (…), do … while

See Declarations and Control flow.

Code fences are ignored

Hyogen blocks inside fenced code blocks are not executed:

```html
<!-- @hg const x = 1 @endhg -->
```

Output preservation

By default, hyogen comment blocks are removed from output. Set preserveHgComments: true to keep them for debugging.

JS comments inside blocks

<!--
@hg

// line comment

/* block comment */

@endhg
-->