This demo illustrates the use of the \pagebreak and \newpage experimental commands in a voluminous document context. These commands force the document to start a new page when compiling to paginated formats such as PDF and DOCX. When compiling to HTML, they emit CSS rules (page-break-before: always; and break-before: page;) which are respected when the HTML is printed or converted to PDF.
A compiler is a special program that translates a programming language's source code into machine code, bytecode or another programming language. The source code is typically written in a high-level, human-readable language such as Java or C++.
Compilers are large and complex programs, but their core principles are well understood. They are usually divided into a frontend and a backend. The frontend handles reading the source code, parsing it into an Abstract Syntax Tree (AST), and performing semantic analysis.
In MarkCharm, the frontend is responsible for parsing the .mc files, resolving macros, handling cross-references, and generating a generic AST.
An Abstract Syntax Tree (AST) is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.
The syntax is "abstract" in the sense that it does not represent every detail appearing in the real syntax, but rather just the structural or content-related details. For instance, grouping parentheses are implicit in the tree structure, so they do not have to be represented as separate nodes.
MarkCharm builds a highly semantic AST. Instead of just nodes like Paragraph or Text, it supports advanced nodes like Draft, Callout, CrossReference, and Figure.
By maintaining a pure semantic AST, MarkCharm allows its backends (HTML, DOCX, Markdown) to decide exactly how to render the final visual output without being constrained by the input syntax.
One of the most critical architectural decisions in MarkCharm is "Style Agnosticism". Backend exporters (like the HTML or DOCX generators) must be 100% style-agnostic. No backend file may reference a specific style (ABNT, IBGE, IEEE, APA).
The backend receives generic tokens (like margins, fonts, spacing, colors) and emits the necessary rendering instructions (CSS for HTML, or OpenXML for DOCX) from those values. It does not interpret, branch on, or default to any style-specific behavior.
Violating style agnosticism creates invisible coupling between the rendering engine and specific norms, making it impossible to add new styles without modifying core backend code. The plugin system exists precisely to externalize all style decisions.
This section concludes our voluminous demo. We have used \pagebreak and \newpage to manually paginate this document into four distinct pages.
When you export this document to .docx or print the generated .html, you will see that each numbered section strictly begins at the top of a new page.