Modular Architecture in MarkCharm

MarkCharm Engineering

September 11, 2026

Abstract

This demonstration showcases the modular snippet architecture and surgical component injection ({$USE}, {#PICK}) in MarkCharm. It illustrates the transparent extraction of tables, system warnings, and dynamic scripts from a component source file (components.mc), preserving auditable traceability and resolving ID collisions.

1 Modular Architecture in MarkCharm

One of MarkCharm's major assets for enterprise documentation engineering is Surgical Inclusion (Snippets). Instead of copying and pasting identical text or tables across dozens of different documents, we can slice specific parts of Single Source of Truth files.

In this example, we natively connect to the components.mc file using the COMP alias.

1.1 Injecting Text Blocks

We will inject a standard security warning defined remotely in the other file, ensuring it fits cleanly into this AST tree:

Warning

Critical Environment Alert This section requires Root permissions to execute. Any structural changes will be recorded in system audit logs.

1.2 Injecting Tables and Complex Structures

The Snippet engine reconstructs structural content. We can pull an entire metrics table defined in the other file. Doing so brings the table into this document, renumbered according to active compilation rules, and gains full validity for Cross-References, as shown here: as detailed in tab. 1.1.

Table 1.1. Q3 Financial Results
Department Revenue Growth
Engineering $45.0M +12%
Sales $82.1M +24%
Marketing $12.4M

-3%

The original document remains untouched, but the final result behaves as if we had written everything by hand in a single file!

1.3 Embedded Script Execution

Snippets are not just for static inclusion. When we remotely import a code block configured for auto-execution in the compiler, it runs and dynamically injects its output at the exact location of our {#PICK} command:

======================================================
| AUTOMATED AUDIT AND COMPILATION SYSTEM            |
| Operational Timestamp:  11/08/2026 10:00:00      |
| Report Integrity: VALIDATED                       |
======================================================

By default, all execution is isolated and interpreted as Verbatim (terminal log lines) for strict security reasons. However, MarkCharm allows document architects to explicitly pass the parse=true flag so that the output string is surgically converted into native Markdown components (such as charts generated natively via for loops):

Table 1.2. Random Sensor Distribution
Sensor ID Load (%) Latitude Longitude
S-001 91

-23.32

19.324
S-002 41

-16.607

18.918
S-003 96 14.44 3.629

This paragraph was instantiated from the components.mc library. However, it is intelligent enough to read the final Abstract Syntax Tree (AST) wherever it lands.


Furthermore, when we instruct the interpreter to parse the generated syntax (parse=true), normal line breaks form natural paragraphs in the target document, perfect for stochastic technical prose generation:

With the parse=true parameter, we can instruct the Engine not to treat this output as log data, but as contiguous narrative prose. See the intelligence-generated incident reports below:

Automated Incident 01: Network latency fluctuated slightly in the primary availability zone during metric assessment (Severity Level: 1). The team took autonomous corrective actions to prevent overall system performance degradation.

Automated Incident 02: Simultaneous access metrics scaled in the primary availability zone during metric assessment (Severity Level: 1). The team took autonomous corrective actions to prevent overall system performance degradation.

Automated Incident 03: Network latency fluctuated slightly in the primary availability zone during metric assessment (Severity Level: 3). The team took autonomous corrective actions to prevent overall system performance degradation.

1.4 Cross-Document Collision Resolution

If we instantiate two elements with the exact same Identifier [id], the engine triggers its Diagnostics Manager and checks AST precedence:

Table 1.3. Original Local Table
Local
Yes

Below we invoke the Snippet that attempts to force the entry of another table with the same structural ID [tab:conflito]:

Table 1.4. Remote Table with Conflicting ID
A B
1 2

Upon compiling this document, the terminal and audit reports will record the following warning: [HIGH] MCW-REF-002 demo_07_list_components/components.mc:78 - Duplicate Anchor ID.

It is critical to note that provenance tracking points back to the original physical line where the second table was extracted, not to the assembly file main.mc. In the face of collision, the compiler does not crash, but resolves the \cref link in favor of the first hierarchical node detected (the upper Table).


2 List Validation and Structured Formats

The external file below demonstrates the conversion of ordered and unordered lists under MarkCharm.

Abstract

This section showcases the rendering of advanced ordered, unordered, and definition lists under the MarkCharm engine. When the abnt_strict flag is not enabled in this mode, it simulates standard web bullet indentation.

3 Advanced Reference System

MarkCharm excels at resolving references in deeply nested structures common in technical and legal standards.

3.1 Structured Lists

The list system uses % markers for deterministic hierarchy. The number of % defines the level, independent of indentation:

The reference to Item 1 of alinea a of inciso I of subsection 3.1 automatically expands to include its full context in the hierarchy.

3.2 Ambiguity Resolution

When two items share the same local number, the compiler automatically includes the minimum necessary context to differentiate them.

Notice how the compiler handles Alinea a of inciso I of subsection 3.2 vs Alinea a of inciso II of subsection 3.2 — each reference includes the minimum ancestor required for unique identification.

3.3 Numbering Modes and Styles

MarkCharm offers an advanced numbering engine and semantic reference resolution, allowing the structural hierarchy of lists to adapt dynamically to technical standards, public solicitations, or international publications.

Below, Chart 3.1 details list numbering modes, citation expansion styles, and ordinal configurations available in the compiler.

Chart 3.1. List Numbering Modes, Expansion Styles, and Ordinals in MarkCharm
Mode / Feature Command Detailed Description and Behavior
Legal \list_mode{abnt_legal} Maps hierarchy to Roman numerals (I, II), Letters (a, b) and Items (1, 2).
Technical \list_mode{abnt_technical} Maps hierarchy to Letters (a, b) at 1st level and Sub-letters (-) at 2nd level. Ideal for engineering reports.
TR \list_mode{tr_legal} Standard structure for Statements of Requirements. Converts 1st level into Clause (1.1) and sublevels into Items.
Sequential \list_mode{seq} Continuous numbering without unified paragraph inheritance. Suitable for executive briefs.
Default Markdown \list_mode{markdown} Preserves standard CommonMark markers (-, *, 1.), maintaining direct compatibility.
Long Style \cross_reference_style{long} Expands taxonomic labels fully in cross-references (e.g., Section 1, Paragraph 2, Item a).
Short Style \cross_reference_style{short} Abbreviates taxonomic labels (e.g., Sec. 1, § 2, item a). Balances conciseness and precision.
Terse Style \cross_reference_style{terse} Omits textual labels, displaying exclusively the unified numeric/alphabetic code (e.g., 1.2.a).
Spelled Ordinals \ordinal_style{words} (default) Converts unnumbered markers to spelled-out ordinals by language and gender (e.g., first item).
Numeric Ordinals \ordinal_style{numeric} Converts unnumbered markers to numeric ordinals with ordinal indicators (e.g., 1st item).

3.3.1 Detailed Mode Explanation

  1. I - Normative List Formats (\list_mode):
  2. II - Expansion Styles and Reference Agreement (\refs and \ordinal_style):

Note

Usage Requirements & Caveats

  1. List Numbering Modes: The \list_mode{...} directive globally alters markers. Define the mode before list structures.
  2. Reference Anchoring: Citation resolution (\Cref{label}, \cref{label}) requires unique label anchors ([label]) on the list item.

Note

Usage Requirements & Technical Caveats

  1. Surgical Snippet Inclusion: Syntax {$USE alias=... doc="..."} declares the remote component, allowing specific blocks to be pulled via {#PICK ALIAS::block}.
  2. Precedence & Auditing: Component files (components.mc) should not contain \maketitle or global metadata, which belong solely to the integrating document (main.mc).