Note: a feature based on this recipe was included in the PmWiki core in version 2.2.119, and can be enabled in config.php with this line:
$EnableEditAutoText = 1;
If you enable the core feature, please disable the current recipe.
The recipe enables automatic insertion of some start-of-line wiki markups.
When a user writes wiki markup, a bulleted list is entered with the sign * before the line. When the user presses "Enter/Return", the script will examine the line and if it starts with *, it will automatically insert a * before the new line, similar to how office suites insert list items. This way the user needs to simply type the text of the new list item.
In a similar fashion, the following start-of-line markups are recognized and re-inserted automatically when the user presses "Enter":
- *, **, ***, ... unordered/bulleted list
- #, ##, ###, ... numbered list
- : definition list
- (space) preformatted text
- ->, -->, -<, --<, ... indented and hanging text
- || simple table row
The above automatic insertions are particularly useful on touch screen devices where it is more difficult to type punctuation.
Additionally, the following keyboard shortcuts might be appreciated by advanced editors with full keyboards:
- Shift+Enter : \\ line break (press and hold down the "Shift" key, press "Enter", then release "Enter" and release "Shift")
- Ctrl+Enter : [[<<]] line break "clear"
- Ctrl+Shift+Enter : ~~~~ author's signature
- Ctrl+L : convert selection to lowercase
- Ctrl+Shift+L : convert selection to uppercase
- Ctrl+Shift+ArrowUp : move current line or selected lines up
- Ctrl+Shift+ArrowDown : move current line or selected lines down
Demo: the recipe is enabled on any page on pmwiki.org, you can test it for example in Main.WikiSandbox.
These edit help functions were first written for a "Structured sections editor" recipe in February 2016 (currently abandoned), but felt so natural and easy to use (a user described them as "exhilarating/addictive"), that I decided to port them to the regular PmWiki text editor. Enjoy!
For PmWiki 2.2.119 or newer, add to config.php:
$EnableEditAutoText = 1;
Older PmWiki versions (only an older version is available):
- Place edithelp.js in your pmwiki/pub directory.
- Add to local/(farm)config.php such a line:
Nothing can be configured at the moment.
In a wiki page, when editing a list item, a definition list, an indented/hanging text, or a simple table, press Enter/Return. The start-of-line markup will re-appear automatically on the new line.
If the markup from the previous line should not be repeated, retype Enter, or simply delete it from the new line (backspace key) and type your text.
- The recipe is likely incompatible with CodeMirror or with any of the WYSIWYG attempts.
Change log / Release notes
- 20191003 added to PmWiki 2.2.119. For subsequent updates please see ChangeLog.
- 20160317 First public release, ready to be tested.
- PmSyntax (Syntax highlighting for the PmWiki documentation and edit form) is compatible with this recipe.
- The CodeMirror recipe also provides automatic insertion of list items, and more. Unfortunately, middle-click-paste does not work with it so I cannot use it.
- Worse (is better) Simple WYSIWYG editing for PmWiki
Recipe written and maintained by Petko.
See discussion at EditHelp-Talk