Revision Date Author Comments
# 47a02a10 04-Jun-2026 Andreas Gohr <gohr@cosmocode.de>

Parsing: make parse syntax a per-parse value, drop ModeInterface

The active parse's syntax flavour is a per-parse question, not process-
global state: within a single request a plugin can render bun

Parsing: make parse syntax a per-parse value, drop ModeInterface

The active parse's syntax flavour is a per-parse question, not process-
global state: within a single request a plugin can render bundled
DokuWiki-syntax text inside an otherwise-Markdown page. Yet ModeRegistry
was a singleton that read $conf['syntax'] and the $PARSER_MODES global,
and every mode reached it through ModeRegistry::getInstance() — so the
flavour lived in shared mutable state that two parses in one request
would fight over.

Make the registry a short-lived value instead:

- ModeRegistry is constructed once per parse with an explicit $syntax
and injected into Parser, Handler and every mode. getSyntax() /
isDwPreferred() / isMdPreferred() consult $this->syntax; the
DOKU_UNITTEST-gated mode-list cache hack is gone (each registry is
fresh, nothing to invalidate).
- p_get_instructions() is now the single place in the pipeline where
$conf['syntax'] is read; from there the flavour travels as a
parameter. No code under inc/Parsing/ reads $conf['syntax'] directly
anymore — the five syntax-reading modes (Preformatted, GfmHr,
GfmEscape, Externallink, GfmQuote) route through $this->registry.

Keep the two concepts apart, as documented in the ModeRegistry and
AbstractMode docblocks: the user's configured *preference* stays in
$conf['syntax'] for UI code (toolbar, settings), while the active
parse's syntax is a parameter carried by the registry.

$PARSER_MODES is demoted to a deprecated, read-only mirror, published
during loadPluginModes() — third-party syntax plugins (columnlist,
alphalist2, phpwikify, skipentity) and the bundled info plugin read the
global directly, often from their constructors, so the taxonomy must
stay visible there. No core code reads the mirror.

Fold ModeInterface into AbstractMode while here: getSort()/handle() are
abstract, the connect callbacks carry defaults, and the public $Lexer
"FIXME should be done by setter" becomes setLexer()/getLexer() injected
by Parser::addMode() alongside the registry. Nested-content resolution
moves to the allowedCategories()/filterAllowedModes() hooks, resolved
once when the registry is attached.

Tests build their own parser/registry through ParserTestBase::setSyntax()
instead of mutating $conf and calling the removed ModeRegistry::reset().

show more ...


# 13a62f81 04-May-2026 Andreas Gohr <andi@splitbrain.org>

rename syntax flavors 'dokuwiki' / 'markdown' to 'dw' / 'md'

Symmetry with the existing 'dw+md' / 'md+dw' setting values.


# 0244be5c 21-Apr-2026 Andreas Gohr <gohr@cosmocode.de>

add GfmDeleted mode for GFM strikethrough (`~~text~~`)

Shares the deleted_open/deleted_close instructions with DW's <del> mode.
Entry/exit anchors `(?<!~)` / `(?!~)` reject runs of three or more til

add GfmDeleted mode for GFM strikethrough (`~~text~~`)

Shares the deleted_open/deleted_close instructions with DW's <del> mode.
Entry/exit anchors `(?<!~)` / `(?!~)` reject runs of three or more tildes
so fenced-code markers remain untouched. Also trim redundant class-level
docblocks on sibling Gfm test files.

show more ...


# 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 ...