| #
2bb62bca
|
| 20-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add GFM em-wrapping-strong modes for `***foo***` / `___foo___`
Two new inline formatting modes that render triple-delimiter runs as em wrapping strong:
GfmEmphasisStrong `***text***`
add GFM em-wrapping-strong modes for `***foo***` / `___foo___`
Two new inline formatting modes that render triple-delimiter runs as em wrapping strong:
GfmEmphasisStrong `***text***` → <em><strong>text</strong></em> GfmEmphasisStrongUnderscore `___text___` → same (MD-preferred only)
Only the exact 3+3 symmetric case is handled. The other long-run and asymmetric variants (4+4, 5+5, `***foo**`, etc.) require CommonMark's stack-based delimiter-pairing algorithm with its flanking and multiple-of-3 rules, which is explicitly out of scope; those examples stay skipped in gfm-spec/skip.php.
Implementation notes:
* Patterns enforce exact 3+3 via `(?<!\*)` / `(?<!_)` lookbehinds (preventing entry at the second `*` of a `****...` run) and `(?!\*)` / `(?!_)` lookaheads after the closing triple (rejecting `***foo****` etc.). Combined with the existing non-whitespace adjacency lookaheads, all asymmetric cases cleanly fall through to other modes or stay literal.
* GfmEmphasisStrong overrides handle() to emit two instructions on entry (emphasis_open + strong_open) and two on exit (strong_close + emphasis_close). GfmEmphasisStrongUnderscore inherits that handler — only delimiters and word-boundary rules differ.
* Sort 65 — below Strong (70) and GfmEmphasis (80) so the em+strong modes win the lexer race for `***`/`___` runs. Underscore variant is MD-preferred-only, matching the existing gating of GfmEmphasisUnderscore and GfmStrongUnderscore.
Per-mode unit tests cover basic matching, single-char bodies, whitespace flanking rejection, paragraph-boundary rejection, longer-run rejection, asymmetric rejection, multibyte intraword protection, and sort values. ModeRegistryTest's gating data provider picks up the two new rules.
Net effect on GfmSpecTest: example #476 (`***foo***`) now passes; 473/474/475/477 remain skipped as documented in skip.php.
show more ...
|
| #
bcefb8ae
|
| 20-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add GFM emphasis and underscore-delimited strong modes
Three new inline formatting modes for GitHub Flavored Markdown:
GfmEmphasis `*text*` → <em> GfmEmphasisUnderscore `_text_`
add GFM emphasis and underscore-delimited strong modes
Three new inline formatting modes for GitHub Flavored Markdown:
GfmEmphasis `*text*` → <em> GfmEmphasisUnderscore `_text_` → <em> (MD-preferred only) GfmStrongUnderscore `__text__` → <strong> (MD-preferred only)
All three emit the same handler instructions as DokuWiki's Emphasis / Strong, so existing renderers need no changes.
Design notes:
* Lexer mode names use snake_case (gfm_emphasis, gfm_emphasis_underscore, gfm_strong_underscore) to keep PascalCase readable at the class level. The asterisk variant emits `emphasis_open`/`emphasis_close` via the getInstructionName() hook, so DW's Emphasis (`//...//`) and GfmEmphasis (`*...*`) can coexist in mixed modes without a lexer state collision while still producing the same <em> output.
* Underscore variants gate on Markdown-preferred syntax (`markdown`, `md+dw`) because `__` otherwise means DW underline. GfmStrongUnderscore sorts at 70 (matching Strong) — below Underline at 90 — so when loaded it wins the lexer race for `__` runs. Underline is already gated out of MD-preferred modes in the previous commit.
* Entry patterns enforce the simplified CommonMark flanking rules already shared across DW inline modes (non-whitespace adjacency, no paragraph-boundary crossing) plus the word-boundary check for underscore variants using NO_WORD_BEFORE / NO_WORD_AFTER. The positive non-word-char enumeration makes them multibyte-safe without requiring the `u` flag: `für_etwas` and `пристаням_стремятся_` correctly stay literal.
Per-mode unit tests cover basic matching, single-char bodies, leading/trailing-whitespace rejection, empty-delimiter rejection, paragraph-boundary rejection, multibyte intraword protection, and sort values. ModeRegistryTest's gating data provider picks up the three new rules.
show more ...
|
| #
35f91432
|
| 20-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
gate Underline on DokuWiki-preferred syntax; tidy registry plumbing
Three related changes to ModeRegistry, prep work for the Markdown modes that follow.
1. Underline (`__text__`) is moved out of lo
gate Underline on DokuWiki-preferred syntax; tidy registry plumbing
Three related changes to ModeRegistry, prep work for the Markdown modes that follow.
1. Underline (`__text__`) is moved out of loadAlwaysModes() and into loadDokuWikiModes(), gated on a new `\$dwPreferred` check that evaluates true for 'dokuwiki' and 'dw+md'. In MD-preferred settings ('markdown' and 'md+dw') `__` will mean GFM strong, so loading Underline there would conflict at the lexer level. Underline is unchanged in the default 'dokuwiki' setting.
2. resolveModeClass() now PascalCases every `_`-separated segment of the mode name, so `gfm_emphasis_underscore` resolves to `GfmEmphasisUnderscore`. Existing lowercase-compound names like `internallink` still resolve to `Internallink` (one segment, ucfirst-ed) — no behaviour change for current modes. This prepares the registry to load Gfm mode classes whose PascalCase filenames preserve word boundaries for readability.
3. ModeRegistryTest's multiple near-identical per-mode gating tests are consolidated into a single data-provider-driven testModeLoadingBySyntax, fed by a `\$rules` table that lists each mode against its four-setting expected load state. Adding a new gated mode now means one line in the provider. Currently only Underline is listed; upcoming Gfm-mode commits will add theirs.
show more ...
|
| #
17c6179b
|
| 20-Apr-2026 |
Andreas Gohr <gohr@cosmocode.de> |
add $conf['syntax'] setting and conditional mode loading in ModeRegistry
Introduce a new 'syntax' configuration setting (dokuwiki, markdown, dw+md, md+dw) that controls which parser modes are loaded
add $conf['syntax'] setting and conditional mode loading in ModeRegistry
Introduce a new 'syntax' configuration setting (dokuwiki, markdown, dw+md, md+dw) that controls which parser modes are loaded. Built-in modes are split into always-loaded (no Markdown equivalent), DW-only, and MD-only groups. Refactor getModes() into focused sub-methods for each group.
No Gfm mode classes exist yet, so only 'dokuwiki' is functional. The change is a strict no-op for existing behavior.
show more ...
|
| #
7958e698
|
| 16-Apr-2026 |
Andreas Gohr <andi@splitbrain.org> |
decouple hardcoded mode names in Eol and Preformatted
Eol.php hardcoded ['listblock', 'table'] as modes to skip, and Preformatted.php hardcoded [\*\-] as a negative lookahead for list markers. Both
decouple hardcoded mode names in Eol and Preformatted
Eol.php hardcoded ['listblock', 'table'] as modes to skip, and Preformatted.php hardcoded [\*\-] as a negative lookahead for list markers. Both embed knowledge that belongs to the respective block modes, not to Eol/Preformatted. Adding a new block mode that handles its own EOL or uses different line start markers would require editing these unrelated files — a hidden coupling.
Listblock and Table now register themselves on ModeRegistry during preConnect(). Eol queries getBlockEolModes() and Preformatted queries getLineStartMarkers() to build its lookahead dynamically. Each mode owns its own data, and new block modes can participate without touching unrelated files.
show more ...
|
| #
1f443476
|
| 16-Apr-2026 |
Andreas Gohr <andi@splitbrain.org> |
split Formatting into individual classes per formatting type
Introduce AbstractFormatting as a base class and seven concrete classes (Strong, Emphasis, Underline, Monospace, Subscript, Superscript,
split Formatting into individual classes per formatting type
Introduce AbstractFormatting as a base class and seven concrete classes (Strong, Emphasis, Underline, Monospace, Subscript, Superscript, Deleted) that each define their own patterns and sort order. Delete the old Formatting class and update tests to use the new classes directly. ModeRegistry now treats formatting modes as regular built-in modes.
show more ...
|
| #
c8dd1b9d
|
| 16-Apr-2026 |
Andreas Gohr <andi@splitbrain.org> |
introduce ModeRegistry to encapsulate parser mode categories
Replace the global $PARSER_MODES definition in inc/parser/parser.php with a ModeRegistry singleton that initializes and manages the mode
introduce ModeRegistry to encapsulate parser mode categories
Replace the global $PARSER_MODES definition in inc/parser/parser.php with a ModeRegistry singleton that initializes and manages the mode categories. The global array is still populated for backward compatibility with plugins that access it directly.
Mode constructors now use ModeRegistry::getModesForCategories() instead of accessing the global directly. p_get_parsermodes() and p_sort_modes() are moved to inc/deprecated.php as thin wrappers.
show more ...
|