From 4de36fdbd73ecdc2006b1fffdbaa715b0cfac0ce Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Wed, 7 Oct 2026 14:29:45 -0500 Subject: [PATCH 1/4] Plan wiki markup and other missing features in the TODO Add docs/TODO/todo-wiki-markup.md (headings, section links and HTML tables in wiki articles only) and short master TODO entries for a readable compare, restoring old versions and a start-discussion button. Co-Authored-By: Claude Opus 5.5 --- docs/TODO.md | 27 +++++++++++ docs/TODO/todo-wiki-markup.md | 88 +++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 docs/TODO/todo-wiki-markup.md diff --git a/docs/TODO.md b/docs/TODO.md index 9ca7b0d..bf34d86 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -40,6 +40,9 @@ from the article's heading structure and render it at the top of the article (likely only worth showing past some minimum heading count, so short articles don't get a token one-entry TOC). +Needs headings first, since phpBB has no heading tag; see +[Wiki markup](TODO/todo-wiki-markup.md). + ## Internal wiki links A lightweight `[[Article Title]]`-style shortcut (MediaWiki's signature @@ -147,3 +150,27 @@ other happened until they check the pending-approval queue. Even a simple "someone else started editing this article at HH:MM" notice on the edit form would help; phpBB's own posting flow has similar double-submission awareness to look at for the pattern. + +## Wiki markup: headings, section links and tables + +Add `== Section ==` headings, `[[Article#Section]]` links and HTML tables, +in wiki articles only, using s9e's allow-list so no unsafe HTML gets +through. Full plan, including the syntax not to add: +[`docs/TODO/todo-wiki-markup.md`](TODO/todo-wiki-markup.md). + +## Readable version compare + +The compare page shows raw BBCode with changes marked in red and green. +Comparing the rendered text would be easier for editors who don't read +BBCode comfortably. + +## Restore an old version + +A one-click "Restore this version" in the version history. Today the only +way is to approve the old version again. + +## Start discussion button + +Articles can link a discussion topic, but only by typing its topic ID by +hand in the edit form. A "Start discussion" button would create the topic +and link it. diff --git a/docs/TODO/todo-wiki-markup.md b/docs/TODO/todo-wiki-markup.md new file mode 100644 index 0000000..24a0b20 --- /dev/null +++ b/docs/TODO/todo-wiki-markup.md @@ -0,0 +1,88 @@ +# Wiki markup: headings, section links and tables + +phpBB already has BBCode, so every extra syntax is a second way to write +something. This plan adds only what BBCode can't do, and only inside wiki +articles. + +## Scope: wiki articles only + +`[[Article name]]` links are safe everywhere and stay enabled in forum +posts. Everything below works only in wiki articles: `== text ==` or a +line starting with `#REDIRECT` in a normal forum post would surprise +people. + +s9e TextFormatter plugins are configured once for the whole board, so the +wiki has to switch the new markup off for normal parsing and back on only +when it saves an article. phpBB's parser events should allow this, but it +needs checking on the test board before anything relies on it. + +## Syntax to add + +| Syntax | What it does | Notes | +|---|---|---| +| `== Section ==` | Headings | phpBB has no heading tag. Also needed for the table of contents. | +| `[[Article#Section]]` | Link to a heading in an article | `#` isn't allowed inside `[[ ]]` today, so this shows as plain text. | +| HTML tables | Tables | See below. | + +## Optional syntax + +| Syntax | What it does | Notes | +|---|---|---| +| `#REDIRECT [[Other article]]` | Redirect set in the article text | Redirects already exist as an editor field; this is a familiar shortcut. | +| `[[Category:Name]]` | Put an article in a category | Only useful once categories are built (see the master TODO). | + +## Syntax not to add + +| Syntax | Why not | +|---|---| +| `'''bold'''`, `''italic''`, `*` lists, `[http://… text]` | BBCode and the editor buttons already do these. | +| MediaWiki tables, `{| … |}` | Fiddly and needs a custom parser; HTML tables are simpler. | +| Templates, `{{Name}}` | A big feature, not worth it for a forum wiki. | + +## HTML tables + +Checked against the copy of s9e TextFormatter bundled with phpBB 3.3: its +built-in **HTMLElements** plugin allows only the HTML elements and +attributes the extension names. Anything else a user types shows as plain +text. + +```php +// in core.text_formatter_s9e_configure_after +$html = $event['configurator']->HTMLElements; +foreach (['table', 'caption', 'thead', 'tbody', 'tr', 'th', 'td'] as $element) +{ + $html->allowElement($element); +} +foreach (['th', 'td'] as $cell) +{ + $html->allowAttribute($cell, 'colspan'); + $html->allowAttribute($cell, 'rowspan'); +} +``` + +- **Built-in safety.** s9e refuses unsafe elements such as `script` and + `iframe`, the `style` attribute, and every `on…` event attribute. + Allowing them needs `allowUnsafeElement()` or `allowUnsafeAttribute()`, + which the wiki must never call. +- **No separate HTML sanitizer.** phpBB stores text as parsed XML and only + renders tags it knows, so a tool like HTML Purifier would add nothing. +- **BBCode works inside cells**, including `[b]`, `[url]` and + `[[Article]]` links. +- **Bad nesting is cleaned up** using HTML's own content rules, so a stray + `` can't break the page layout. + +Other table options considered: + +| Option | For | Against | +|---|---|---| +| HTML tables (HTMLElements) | Familiar, least new code, safety from s9e itself | Needs the wiki-only setup above | +| `[table]` BBCodes | Fits phpBB's style; could get editor buttons | Four BBCodes (`table`, `tr`, `th`, `td`); verbose to type | +| MediaWiki `{| … |}` | Familiar to Wikipedia editors | Custom parser; easy to get wrong | + +## Still to decide + +- Heading levels: only `==` and `===`, or the full MediaWiki range. +- Anchor names for headings, so `[[Article#Section]]` matches reliably + (spaces, case, non-ASCII titles). +- Whether existing articles need reparsing after the change, using the + extension's reparser (`php bin/phpbbcli.php reparser:reparse`). From 29e422e976c44b8e27c6acc2b0b75b8492c8e7f7 Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Wed, 7 Oct 2026 14:37:15 -0500 Subject: [PATCH 2/4] Describe how wiki-only markup is kept out of forum posts Co-Authored-By: Claude Opus 5.5 --- docs/TODO.md | 39 +---------------------------------- docs/TODO/todo-wiki-markup.md | 31 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index bf34d86..f0fefa9 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -40,18 +40,6 @@ from the article's heading structure and render it at the top of the article (likely only worth showing past some minimum heading count, so short articles don't get a token one-entry TOC). -Needs headings first, since phpBB has no heading tag; see -[Wiki markup](TODO/todo-wiki-markup.md). - -## Internal wiki links - -A lightweight `[[Article Title]]`-style shortcut (MediaWiki's signature -syntax) instead of requiring a full `[url=...]` BBCode every time you want -to link one article to another. Would need a custom BBCode or a message-parse -step that resolves `[[...]]` to the right article URL, including handling -the "target article doesn't exist yet" case (MediaWiki renders those as a -distinct "red link" style). - ## Move/rename an article The URL slug is fixed forever once an article is created — only the title @@ -110,8 +98,7 @@ picks "Forum-style" or "Wiki-style" for how the extension's own templates render) rather than ripping out the current look — some boards will prefer wiki content to visually match the rest of the forum, others will want it to look like an actual wiki. Scope depends heavily on the table of contents -and internal wiki links items above landing first, since a real wiki -layout wants both. +item above landing first, since a real wiki layout wants one. ## Recent Changes feed @@ -150,27 +137,3 @@ other happened until they check the pending-approval queue. Even a simple "someone else started editing this article at HH:MM" notice on the edit form would help; phpBB's own posting flow has similar double-submission awareness to look at for the pattern. - -## Wiki markup: headings, section links and tables - -Add `== Section ==` headings, `[[Article#Section]]` links and HTML tables, -in wiki articles only, using s9e's allow-list so no unsafe HTML gets -through. Full plan, including the syntax not to add: -[`docs/TODO/todo-wiki-markup.md`](TODO/todo-wiki-markup.md). - -## Readable version compare - -The compare page shows raw BBCode with changes marked in red and green. -Comparing the rendered text would be easier for editors who don't read -BBCode comfortably. - -## Restore an old version - -A one-click "Restore this version" in the version history. Today the only -way is to approve the old version again. - -## Start discussion button - -Articles can link a discussion topic, but only by typing its topic ID by -hand in the edit form. A "Start discussion" button would create the topic -and link it. diff --git a/docs/TODO/todo-wiki-markup.md b/docs/TODO/todo-wiki-markup.md index 24a0b20..aa2107f 100644 --- a/docs/TODO/todo-wiki-markup.md +++ b/docs/TODO/todo-wiki-markup.md @@ -12,9 +12,34 @@ line starting with `#REDIRECT` in a normal forum post would surprise people. s9e TextFormatter plugins are configured once for the whole board, so the -wiki has to switch the new markup off for normal parsing and back on only -when it saves an article. phpBB's parser events should allow this, but it -needs checking on the test board before anything relies on it. +wiki switches the new markup off for normal parsing and back on only when +it saves an article. Checked against phpBB 3.3's parser code: + +- In `core.text_formatter_s9e_parser_setup`, call + `$parser->disable_bbcode('name')` for each wiki-only BBCode, and + `disablePlugin('HTMLElements')` on the underlying s9e parser for tables. + That covers posts, private messages, signatures and previews. +- When the wiki saves an article, call `enable_bbcode()` (and + `enablePlugin('HTMLElements')`) just for that save, then switch them off + again. +- phpBB's posting code can't re-enable these by accident. Its "BBCode on" + switch only re-enables the BBCodes plugin, not single tags, and its + per-tag switches only touch `img`, `flash`, `quote` and `url`. +- In a forum post, a wiki-only BBCode shows as plain text, like an unknown + BBCode does today. + +Admins could also make their own ACP-created BBCodes wiki-only, matched by +name, through an ACP setting listing them. The editor buttons for wiki-only +BBCodes appear only on the wiki edit page. + +Limits: + +- This stops new use only. Text saved before a BBCode was made wiki-only + keeps its formatting. +- Quoting an article into a forum post turns wiki-only tags into plain + text there. + +Still to confirm on the test board before building on it. ## Syntax to add From 396be57d2e6357ce43dbb617dae513f9a0fdf8cd Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Wed, 7 Oct 2026 14:37:31 -0500 Subject: [PATCH 3/4] Restore the TODO entries dropped by the previous commit Co-Authored-By: Claude Opus 5.5 --- docs/TODO.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/TODO.md b/docs/TODO.md index f0fefa9..bf34d86 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -40,6 +40,18 @@ from the article's heading structure and render it at the top of the article (likely only worth showing past some minimum heading count, so short articles don't get a token one-entry TOC). +Needs headings first, since phpBB has no heading tag; see +[Wiki markup](TODO/todo-wiki-markup.md). + +## Internal wiki links + +A lightweight `[[Article Title]]`-style shortcut (MediaWiki's signature +syntax) instead of requiring a full `[url=...]` BBCode every time you want +to link one article to another. Would need a custom BBCode or a message-parse +step that resolves `[[...]]` to the right article URL, including handling +the "target article doesn't exist yet" case (MediaWiki renders those as a +distinct "red link" style). + ## Move/rename an article The URL slug is fixed forever once an article is created — only the title @@ -98,7 +110,8 @@ picks "Forum-style" or "Wiki-style" for how the extension's own templates render) rather than ripping out the current look — some boards will prefer wiki content to visually match the rest of the forum, others will want it to look like an actual wiki. Scope depends heavily on the table of contents -item above landing first, since a real wiki layout wants one. +and internal wiki links items above landing first, since a real wiki +layout wants both. ## Recent Changes feed @@ -137,3 +150,27 @@ other happened until they check the pending-approval queue. Even a simple "someone else started editing this article at HH:MM" notice on the edit form would help; phpBB's own posting flow has similar double-submission awareness to look at for the pattern. + +## Wiki markup: headings, section links and tables + +Add `== Section ==` headings, `[[Article#Section]]` links and HTML tables, +in wiki articles only, using s9e's allow-list so no unsafe HTML gets +through. Full plan, including the syntax not to add: +[`docs/TODO/todo-wiki-markup.md`](TODO/todo-wiki-markup.md). + +## Readable version compare + +The compare page shows raw BBCode with changes marked in red and green. +Comparing the rendered text would be easier for editors who don't read +BBCode comfortably. + +## Restore an old version + +A one-click "Restore this version" in the version history. Today the only +way is to approve the old version again. + +## Start discussion button + +Articles can link a discussion topic, but only by typing its topic ID by +hand in the edit form. A "Start discussion" button would create the topic +and link it. From a4002ef2cccfb5870d93bef7fec6f402158c0215 Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Wed, 7 Oct 2026 14:38:38 -0500 Subject: [PATCH 4/4] Add page locking, templates and infoboxes, and file uploads to the TODO Co-Authored-By: Claude Opus 5.5 --- docs/TODO.md | 34 +++++++++++++++++++++++++++----- docs/TODO/todo-wiki-markup.md | 37 +++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index bf34d86..dc96032 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -142,7 +142,7 @@ falling back to "any group with `u_wiki_edit`" when no restriction is set on a given article, so this is opt-in per article rather than a behavior change for existing ones. -## Edit-conflict detection +## Edit-conflict detection and page locking Nothing currently warns two people editing the same article at once — they'd just end up with two competing pending versions and no idea the @@ -151,11 +151,19 @@ other happened until they check the pending-approval queue. Even a simple form would help; phpBB's own posting flow has similar double-submission awareness to look at for the pattern. -## Wiki markup: headings, section links and tables +A stronger option is page locking: opening the edit form locks the +article for that user for a limited time (for example 30 minutes, renewed +while they keep editing). Others see who holds the lock and until when, +and can't save until it's released or expires. Moderators can break a +lock. Expiry matters, since people often close the browser without +saving. This is separate from per-article edit protection above, which +limits *who* may edit, not *when*. -Add `== Section ==` headings, `[[Article#Section]]` links and HTML tables, -in wiki articles only, using s9e's allow-list so no unsafe HTML gets -through. Full plan, including the syntax not to add: +## Wiki markup: headings, section links, tables and templates + +Add `== Section ==` headings, `[[Article#Section]]` links, HTML tables and +reusable templates and infoboxes, in wiki articles only, using s9e's +allow-list so no unsafe HTML gets through. Full plan, including the syntax not to add: [`docs/TODO/todo-wiki-markup.md`](TODO/todo-wiki-markup.md). ## Readable version compare @@ -174,3 +182,19 @@ way is to approve the old version again. Articles can link a discussion topic, but only by typing its topic ID by hand in the edit form. A "Start discussion" button would create the topic and link it. + +## File uploads + +Let editors upload images and files to an article, the way posts take +attachments. phpBB's attachment system is built around posts and private +messages, so the wiki either needs its own upload handling or a careful +reuse of phpBB's file upload classes with its own table. + +- Uploads belong to an article and survive across its versions; deleting + an article deletes them. +- Reuse the board's allowed file types, size limits and quota where + possible, with a separate permission to upload. +- Serve files through the extension's own controller, which checks the + reader's wiki permissions, never straight from a public folder. +- An uploaded image can be placed in the article text, for example with + `[[File:Diagram.png]]`. diff --git a/docs/TODO/todo-wiki-markup.md b/docs/TODO/todo-wiki-markup.md index aa2107f..b9c8d93 100644 --- a/docs/TODO/todo-wiki-markup.md +++ b/docs/TODO/todo-wiki-markup.md @@ -1,4 +1,4 @@ -# Wiki markup: headings, section links and tables +# Wiki markup: headings, section links, tables and templates phpBB already has BBCode, so every extra syntax is a second way to write something. This plan adds only what BBCode can't do, and only inside wiki @@ -62,7 +62,6 @@ Still to confirm on the test board before building on it. |---|---| | `'''bold'''`, `''italic''`, `*` lists, `[http://… text]` | BBCode and the editor buttons already do these. | | MediaWiki tables, `{| … |}` | Fiddly and needs a custom parser; HTML tables are simpler. | -| Templates, `{{Name}}` | A big feature, not worth it for a forum wiki. | ## HTML tables @@ -104,8 +103,42 @@ Other table options considered: | `[table]` BBCodes | Fits phpBB's style; could get editor buttons | Four BBCodes (`table`, `tr`, `th`, `td`); verbose to type | | MediaWiki `{| … |}` | Familiar to Wikipedia editors | Custom parser; easy to get wrong | +## Templates and infoboxes + +Reusable blocks written once and included in many articles, such as a +"This article is out of date" notice, or an infobox: a side box of facts +like *Version*, *Author* and *Requires* that each article fills in. + +```text +{{Out of date}} + +{{Extension infobox +| name = Wiki +| version = 1.1.0 +| requires = phpBB 3.3.19 +}} +``` + +- A template is itself a wiki page, for example `Template:Extension + infobox`, so it gets versions, approval and permissions for free. +- Parameters (`| name = …`) fill named placeholders in the template. +- The template is inserted when the article is shown, not when it's saved, + so editing a template updates every article using it. This needs a cache + of rendered articles that's cleared when a template changes. +- Templates must not include themselves, directly or through another + template; stop after a small fixed depth. +- Template text goes through the same parser and allow-list as article + text, so a template can't bring in HTML or BBCode an article couldn't. +- **What links here** should also list the articles using each template. + +This is the biggest item in this plan; build it after headings and tables. + ## Still to decide +- Template syntax: MediaWiki's `{{Name | key = value}}`, or a BBCode such as + `[template=Name]`, which fits phpBB's editor buttons better. +- Whether infoboxes get a default floating-box style in prosilver, or each + template brings its own HTML table. - Heading levels: only `==` and `===`, or the full MediaWiki range. - Anchor names for headings, so `[[Article#Section]]` matches reliably (spaces, case, non-ASCII titles).