Summary: Simple "edit section" for wiki pages
Version: 20220101
Prerequisites: JavaScript, recent browser
Status: experimental
Maintainer: Petko
License: GPL
Users: (view? / edit)
Discussion: EX-Talk?

Simple "edit section" for wiki pages.


The recipe allows editing of wiki pages, section by section, where sections are separated by the top-level headings in the page.

Here are the differences from Cookbook:SectionEdit:

  • Single level sections. The recipe finds the largest heading in a page ("!", "!!", "!!!"...), then splits the page into sections starting with this level of headings.
    • An anchor preceding the heading like [[#description]] will be included in the section with that heading.
  • Only headings from the current page will have "edit" links.
    • Included pages, sections, and page text variables won't have edit links, however from PmWiki 2.3.0 you can list the included sections in the edit form, see $EnableIncludedSections to easily access these too.
  • The PHP code is much simpler, and doesn't override core functions including text sections.
  • There is a JavaScript program that does most of the work on the browser.
  • In the editing form, a dropdown menu allows to edit other sections in the page, or the full page. It is inserted above the edit text area and before the GUI edit buttons (if you have them enabled).
    • The dropdown is updated automatically as you add, modify, swap or remove headings and sections.
  • You can edit the "Lead section" (before the first heading) from the dropdown menu.
  • Works when you "save-and-edit" the page, when you "preview" the page (the full page is shown) and with Cookbook:PreviewChanges.
  • It may make it easier to edit with Cookbook:PmSyntax for very large pages or on slower hardware (also applies to SectionEdit).

The recipe is enabled on this page and on the Talk page, feel free to test it.


  1. Get ex.zipΔ, open it, and place the file ex.php in your pmwiki/cookbook directory, and the file ex.js in your pmwiki/pub directory.
  2. Add to config.php this line:


Not EX-specific, but setting $EnableIncludedSections = 1; in config.php will allow easy access to edit pages included from the current page.


The following strings can be translated in an XLPage, for example in French:

  'Edit section...' => 'Éditer la section...',
  '*Full page' => '*Page entière',
  '^Lead section (before the first heading)' => '^Résumé introductif (avant la première section)',

Note that I am not completely satisfied with these strings, if you have suggestions for better ones, we can change them. (In such a case, the translations will also need updating.)

The recipe also reuses the "Edit" word which is usually already translated.


When you browse a page you can edit, [Edit] links appear after the top level headings in the page. Click on such a link to edit that section.

Use the dropdown to change sections.


To do / some day / maybe

  • After a page is saved, maybe scroll to the last edited section.

Change log / Release notes

  • 20220101 : First public release, ready to be tested.

See also

Cookbook /
BreakPage  Breaks pages into sections with inserted markers and displays one section at a time (Stable)
FoxEdit  add edit links for editing page sections and PTVs with Fox (stable)
IncludeWithEdit  Enable editing of included text (last tested on PmWiki Version 2.2.0.beta45)
LiveEdit  Edit blocks of wiki-text in pop-up windows right from the wiki page. Editable blocks can be automatically detected/created on existing wiki pages using a Javascript-based GUI-like tool. An authenticated user with edit permission can edit the contents inside the blocks right from the page's view in a 'pop-up' editing environment. One can now choose from different themes/skins for the LiveEdit environment, as well as create custom themes/skins. Very useful for better organizing and maintaining contents of a wiki page, especially if the page is large. (Working great! Latest improvements in auto-detect tool are in beta test.)
SectionEdit  Split a wiki page into separately editable sections with an edit link for each section (Stable)


Written and maintained by Petko.


See discussion at EX-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.