Demo 44: Multiline Shorthand and Linter Warnings

Abstract

This demo shows the MarkCharm compiler's flexibility in handling line breaks inside short commands. It illustrates the smart Linter rule (MCW-SYN-003), which warns the user about unnecessary breaks in 1-argument commands, but allows structuring complex macros (2+ arguments) and multi-line revision commands.

1 The Draft Command

MarkCharm allows draft blocks to be formatted across multiple lines, ensuring visual organization for whoever writes or reviews the source file:

Draft 1.1
Hello! This is a multi-line draft. You will notice that it does not trigger any Linter alerts during compilation. We can even inject Markdown here as a link.

2 Educational Warnings (MCW-SYN-003)

The linter triggers the MCW-SYN-003 alert for commands (native or user-defined) with 1 argument that have been broken into multiple lines, because this harms the readability of fluid text (Markdown).

For example, a native in-line formatting command:

This is a snippet with in-line formatting (bold). Using multiple lines for short commands is a bad practice.

The same happens with a custom macro with 1 argument:

Macro1: An argument broken into multiple lines. Generates a warning in the terminal!

3 Complex Commands (No Warnings)

On the other hand, macros that receive 2 or more arguments frequently need to be broken into multiple lines to organize parameters in the source file. MarkCharm recognizes this need and emits no warnings for these cases.

The native \textcolor command (which receives 2 arguments: color and text) compiles without generating alerts:

A sentence highlighted in blue that has its line break silently respected.

The same applies to user-defined macros with 2 arguments:

Macro2: [First long argument that needed to be broken on the line for organization.] and [Second argument that also looked better on the line below.]

And even more structural commands, such as this 4-argument macro:

Macro4: 1=Parameter A (Configuration X), 2=Parameter B (Configuration Y), 3=Parameter C (Validation), 4=Parameter D (Result)

Finally, a macro that generates a parameterized table, encapsulating a structured data block (now with 3 arguments, the last being the anchor label) inside the table directive. Below you will see the data that will be summarized in the tables (all generated by the same macro, but with distinct IDs): tab. 1, tab. 2 and tab. 3.

Table 1. Dynamic Table
Key Value
Data Inserted in Column 1 of Table 1 Data Inserted in Column 2 of Table 1
Table 2. Dynamic Table
Key Value
Data Inserted in Column 1 of Table 2 Data Inserted in Column 2 of Table 2
Table 3. Dynamic Table
Key Value
Data Inserted in Column 1 of Table 3 Data Inserted in Column 2 of Table 3

The tables generated above can be referenced normally in the body of the text using their identifiers. For example, see the data summarized in tab. 1, compared to tab. 2 and tab. 3. This is the architecturally correct way to parameterize blocks that require cross-references in MarkCharm.


Note

Caveats and Usage Requirements: This demo must be compiled with the -D DRAFT flag so that the blue \draft blocks are rendered in the output HTML. Furthermore, observe the console messages generated during compilation: the bad practice warning (MCW-SYN-003) must appear only for \textbf and for \macroUm (both with 1 argument). The \textcolor, \macroDois, \macroQuatro, and \macroTabela commands must not trigger any warnings.