Skip to content

Hiding headers

::hide
::hide{header}
::hide{footer}
FlagMeaning
headerHide the header on this page
footerHide the footer on this page
(none)Hide both

::hide affects only the page that contains it. It does not change page numbers or {pages}. Use it right after a ::pagebreak, for a chapter title page for example.

For the very first page there is no need for a directive: the profile settings Hide header on first page and Hide footer on first page do the same.

cover-page/document.md
::header[Annual report||2026]
::footer[|Page {page} of {pages}|]
# Annual Report 2026
Prepared for the board.
::pagebreak
::hide{header}
::toc{depth=2}
::pagebreak
::pagenumber{start=1}
## Summary
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
::pagebreak
## Results
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
MDLeaf lays Markdown out on real pages. Paragraphs flow from page to page, and the page view shows exactly what the PDF will contain.
A cover page without header and footer, a contents page, and numbering that restarts at 1 for the first chapter. {pages} counts the displayed numbers.
Download sample (.mdl)

Open it in MDLeaf with Library → Import .mdl. If MDLeaf is installed, you can also open the file directly.

  • ::hide{both} — both is not a flag (directive-attr-unknown); write ::hide.
  • A ::hide far from a page break may land on the previous page. Put it directly after ::pagebreak.