$$Include{docs/siteMacros.textCarver}

# ATX Headers

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

$$example{}
\# Level 1 header
\## Level 2 header

$$exampleRight{}
\<h1>Level 1 header\</h1>
\<h2>Level 2 header\<h2>

$$endExample{}


### 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:

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

$$exampleRight{}
\<div class="chapter">
\<h1>1: First Chapter\</h1>
\</div>
\<div class="chapter">
\<h1>2: Second Chapter\</h1>
\</div>

$$endExample{}



[Next: Ingesting files](3bIngesting.html)
