PmWiki 2.4.0
27 January 2025
PmWiki version 2.4.0 is now available (major release).
Upgrading to PmWiki 2.4.0
PmWiki 2.4.0 can be upgraded to (or installed) using any of Installatron's products. Use Installatron's optional Automatic Update feature to automatically apply PmWiki updates as new versions are released, or use Installatron's Clone feature to duplicate an existing PmWiki install to test the 2.4.0 upgrade prior to applying it live. Get started managing your PmWiki installations with Installatron
What's New in PmWiki 2.4.0
Site Breaking Changes
- (If you have custom styles for core elements, check if the following need to be updated:)
- Table of contents has kept the same class names, but the wrapping elements are now <details>, <summary> for the "Contents" line and <nav> for the links. If you have styled div.PmTOCdiv and div.PmTOCtable, you can only keep the class names .PmTOCdiv and .PmTOCtable.
- Cookbook:LocalTimes added a [+] button on RecentChanges to pull recent history entries. It was a b.rcplus element styled like a button, now it is a real button with the classes "inputbutton rcplus". Custom styles can probably be removed, as it will now look like other buttons on the wiki.
- Cookbook:PmSyntax can now be enabled on multiple textareas, so the highlighting block identifiers have been changed to class names. If you have styled for #hwrap and #htext, you should now change these to .hwrap and .htext.
- PmWiki previously injected core styles to $HTMLStylesFmt, these have been moved to a file pub/lib/pmwiki-core.css and changed to use CSS variables for both light and dark color themes. It is now much easier to redefine these from a skin or from local css, but these can also be disabled with such a line in config.php or in a skin: unset($HTMLHeader1Fmt['core-css']); Some skins disable the core styles and provide their own, if you notice any style issues with the latest version of your skin, try the above line.
- If you inject a custom <meta charset> element to $HTMLHeaderFmt, it is now recommended to add it to $HTMLHeader1Fmt instead, as browsers expect the charset information to be as early as possible in the HTML source.
Structure, JavaScript and CSS
- Added a new pub/lib directory, moving core files such as pmwiki-utils.js, pmwiki-syntax.css, pmwiki-syntax.js, and pmwiki-darktoggle.js to it.
- Added pmwiki-core.css which includes core styles previously injected into $HTMLStylesFmt. This change is aimed at improving performance and supporting stricter Content-Security-Policy. The styles include support for both light and dark themes and responsive layouts, with easier customization options.
- Added pmwiki-lib.js, a new core JavaScript library for DOM manipulation, asynchronous operations, preference storage, and reporting. These functions can also be used by recipes.
- Added $HTMLHeader1Fmt for insertion right after the <head> tag to facilitate early loading of scripts and styles, improving features like dark mode and easing core style overrides by skins.
- Refactored the InsertWikiPageCSS() function. Added $WikiPageInlineCSS (default enabled); if set to 0, local styles will be served as a separate browser request ($PageUrl?action=pagecss), aligning with the stricter Content-Security-Policy.
Form and Textarea
- The form "Preview" button now does not require validation.
- Improved $EnableMergeLastMinorEdit behavior.
- If $EnableEditAutoText is set to 2, any textarea with the autotext class will enable Cookbook:EditHelp. New shortcuts for line swapping (Alt+ArrowUp and Alt+ArrowDown) have been added.
- Introduced $EditAutoBrackets to automatically insert closing characters in autotext textareas. If text is selected, typing an opening character will wrap the selection with matching characters.
- If $EnablePmSyntax is set to 2, any textarea with the class pmsyntax will enable Cookbook:PmSyntax. The F8 key can now toggle syntax highlighting.
- Added the (:input range:) element to forms.
- Added support for data-labelvalue="1" attribute in form elements like color and range inputs to display their values.
Variables
- Added $EnableUploadTargets and $UploadTargets to track files attached to a page.
- Introduced $RehashedPassword, which contains a new hash when a user logs in with an outdated password hash, allowing add-ons to update the password hash.
- Added $PagePathResolveFmt, if enabled, will resolve the current page name instead of $PagePathFmt. This is useful for wikis where both Main.Name and Name.HomePage (or Name.Name) exist, allowing the Name group to open instead of Main.Name.
Table of Contents
- The Table of Contents now uses a <details><summary> element for toggling. Custom styles for div.PmTOCdiv should be updated to .PmTOCdiv, and div.PmTOCtable should be updated to .PmTOCtable. The back arrow is now defined in CSS.
Highlights
- Added helper function XLHSC() and updated PosArgs().
- The RecentChanges "plus" button in Cookbook:LocalTimes is now an input button element. After downloading recent page edits, it will display "minus" instead of disappearing, and clicking "minus" will hide the edits and toggle back to "plus".
- The ?action=diag page now includes defined constants and functions, aiding diagnostics.
- A couple of bugs have been fixed.
Documentation
- Simplified the docs/sample-config.php.
- $EnableCopyCode works only on HTTPS websites. It will be disabled on HTTP without any console errors.
- Updated documentation to reflect changes and new features.