EditHelp
Note: a feature based on this recipe will be included in the PmWiki core as of 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.
Description
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
Demo: the recipe is enabled on this page, on the Talk page, and on the Users page.
These edit help functions were first written for a "Structured sections editor" recipe in February 2016 (currently under development/testing), 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!
Installation
For PmWiki 2.2.119 or newer, add to config.php:
$EnableEditAutoText
= 1;
Older PmWiki versions:
- Place edithelp.js in your pmwiki/pub directory.
- Add to local/(farm)config.php such a line:
if($action == 'edit') $HTMLFooterFmt['edithelp'] = '<script type="text/javascript" src="$FarmPubDirUrl/edithelp.js"></script>';
Configuration
Nothing can be configured at the moment.
Usage
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, simply delete it from the new line (backspace key) and type your text.
Notes
- A recent browser with JavaScript enabled is needed for the recipe to work.
- The recipe is likely incompatible with CodeMirror or with any of the WYSIWYG attempts.
Change log / Release notes
- 20160317 First public release, ready to be tested.
See also
- 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
Contributors
Recipe written and maintained by Petko.
Comments
See discussion at EditHelp-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.