Table of Contents
DivAlign2 Plugin
Compatible with DokuWiki
- 2022-07-31 "Igor" unknown
- 2020-07-29 "Hogfather" yes
- 2018-04-22 "Greebo" yes
- 2017-02-19 "Frusterick Manners" yes
The divalign2 plugin provides a means to specify paragraph alignment in DokuWiki pages, using nothing more than CSS directives.
Some years ago, Jason Byrne contributed with his first plugin, divalign which allowed a simple, unobtrusive syntax to use a feature that the original DokuWiki engine lacked: paragraph alignment. At some point at Dec. 2008, in order to implement some fixes and suggestions, after failing to contact the author to provide some fixes and suggestions, I decided to implement a fork. Here are the results.
Feel free to use and comment (see ⇒Discussion).
Usage
Simple syntax used to align text or images.
Note that you can achieve the same results by using the wrap plugin.
Download and Installation
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
The link above will always point to the latest stable current release candidate. Should you need an older, archived version, or a download right out from master
, check the plugin's webpage which contains the required links: http://ryan.gulix.cl/dw/desarrollo/dokuwiki/ .
Note: As of June 2020, plugin is in release candidate stages to check compatibility with Hogfather. If you can test the plugin and report back, feedback is welcome!
Note: Versions of Dokuwiki previous to Rincewind are no longer supported.
Syntax
Align Left:
#;; This is aligned left. #;;
Align Right:
;;# This is aligned right. ;;#
Align Center:
;#; This is aligned center. ;#;
Align Justify:
### This text is justified. ###
Previous versions of this plugin had a “Misfeature” that allowed to align multiple paragraphs at once by wrapping the first and last of them with the syntax. This is no longer supported.
Not working as expected, Example : ;#; Nothing Happens, this text is not centralize!! ;#;
Also when trying to align headers #;;
Will you marry me .. Tuli :-)
#;;
- The markup has to be on separate lines
- You cannot have markup in headers
Demo
Want to see the plugin in action? http://ryan.gulix.cl/tests.doku/current_/doku.php/divalign2
Other Details
Edit Toolbar
The plugin now incorporates a Toolbar Picker Button for the alignment mode. You click it, and are presented with four buttons to set left, center, right or justified alignment. Thanks to faraday for new, sleeker icons integarted in the divalign-2.3 versions and above.
script.js
The script.js
packaged with this plugin no longer displays the picker icons. If this is your case, use this as a replacement:
- script.js
if(window.toolbar!=undefined){ var align_da2_arr={ '#;;\nParagraph\n#;;\n': 'pleft.png', ';#;\nParagraph\n;#;\n': 'pcenter.png', ';;#\nParagraph\n;;#\n': 'pright.png', '###\nParagraph\n###\n': 'pjustify.png'}; toolbar[toolbar.length] = { "type":"picker", "title": "Alignment", "icon" : "../../plugins/divalign2/images/pleft.png", "key" : "a", "list" : align_da2_arr, "icobase" : "../../lib/plugins/divalign2/images", /* In some configurations, you may have to remove "lib" from path: "icobase" : "../../plugins/divalign2/images" */ }; } /* end of divalign2/script.js */
In addition, you should probably remove /divalign2/action.php
, which duplicates the picker toolbar item with the same problems as the original script.js
.
— Myron Turner 2016-09-20 03:05
Browser Support
Any browser that supports CSS will align the content correctly. Not much of an issue here.
ODT export should render with the correct alignment.
Text renderers and devices happily ignore this plugin.
Syntax details
Because it uses the same syntax, this plugin is marked as both similar and conflicting with the original Divalign. All tags are the same and have similar requirements except where noted below.
Unlike the original plugin, divalign2
requires that the enter/exit syntax take place at the beginning/end of their lines, respectively. Thus, the following should not work:
;;# This text will not be aligned right. ;;#
This plugin may interfere with other plugins that float content (such as gchart). This is untested however.
Changelog
See the repository page or here.
Source Code
Unzipping the file from the download link above will give you the source code, as will do checking the source repo. It is free, in the GPL definition of the word.
Discussion
Ask questions here. Also includes the discussion archive before this revision.