ATX Headers

ATX headers are one of the most useful markdown features. Why are they called ATX headers? Nobody knows.

This

# Level 1 header
## Level 2 header

Becomes

<h1>Level 1 header</h1>
<h2>Level 2 header<h2>

Customizing ATX headers

Sometimes it’s handy to customize the behavior of ATX headers. There are two main use cases for this:

  1. You want to add non-trivial decoration to a header.
  2. You want to trigger additional code every time a particular header is executed.

To enable those use cases while maintaining clean Markdown source, TextCarver allows you to override how ATX headers get generated:

This

$$h1 = {{
<div class="chapter">
<h1>$$num{}: $$Args[0]{}</h1>
</div>
$$num = $$JS{$$num{} + 1;}
}}
# First Chapter
# Second Chapter

Becomes

<div class="chapter">
<h1>1: First Chapter</h1>
</div>
<div class="chapter">
<h1>2: Second Chapter</h1>
</div>

Next: Ingesting files