DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:numberedheadings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:numberedheadings [2019-01-03 01:59] – add css support for numbers in headings s.saharaplugin:numberedheadings [2023-09-13 08:34] (current) – update version s-sahara
Line 1: Line 1:
-====== Plugin Numbered Headings ======+====== Numbered Headings Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 6: Line 6:
 email      : sahara.satoshi@gmail.com email      : sahara.satoshi@gmail.com
 type       : syntax type       : syntax
-lastupdate : 2019-01-03 +lastupdate : 2023-09-12 
-compatible : 2013-06-032009-12-252014-09-29 "Hrun"2015-08-10 "Detritus"+compatible : 2018-04-222020-07-292022-08-022023-04-04
 depends    : depends    :
 conflicts  : ckgedit, include conflicts  : ckgedit, include
Line 27: Line 27:
 ===== Usage ===== ===== Usage =====
  
-To use this plugin just add a '-' between the '=and the actual heading:+Adding "''%%-%%''" before the heading text will make the headings tiered-numbered. You can choose the first-tier level (**tier1**) in the Configuration manager. The **tier1** may be a fixed value (eg. level 2) or auto-detected in the page. You can use "''%%-#<number>%%''" to set number of the heading
   ====== - Level 1 Headline ======   ====== - Level 1 Headline ======
   ===== - Level 2 Headline =====   ===== - Level 2 Headline =====
 +  ==== -#5 Level 3 Headline ====
   ==== - Level 3 Headline ====   ==== - Level 3 Headline ====
 +  ===== -#7 Level 2 Headline =====
   ==== - Level 3 Headline ====   ==== - Level 3 Headline ====
-  ===== - Level 2 Headline ===== 
-  ==== - Level 3 Headline ==== 
-  ... 
-The output should then look like this: 
-  1. Level 1 Headline 
-      1.1 Level 2 Headline 
-          1.1.1 Level 3 Headline 
-          1.1.2 Level 3 Headline 
-      1.2 Level 2 Headline 
-          1.2.1 Level 3 Headline 
-  ... 
  
 +When the config **tier1** is set to 2, the headings are interpreted as if you have written:
 +  ====== Level 1 Headline ======
 +  ===== 1. Level 2 Headline =====
 +  ==== 1.5 Level 3 Headline ====
 +  ==== 1.6 Level 3 Headline ====
 +  ===== 7. Level 2 Headline =====
 +  ==== 7.1 Level 3 Headline ====
 +  
 +=== Experimental: Alpha-numeric numbering ===
  
 +Character variables can be incremented in PHP, like A0, A1, A2 ... You can use ''%%-"<string>"%%'' to set number string of the heading.
  
-The user can also set the outline level with the following markup (Thanks to [[martin@idea-games.com|Martin Klima]]):+  ==== -"A1" Appendix ==== 
 +  === - headline ===
  
-  === - #<number> Heading text === 
  
-For example:+===== Configuration =====
  
-  ====== - #3 Level 1 Headline ====== +The plugin can be configured within the DokuWiki configuration manager available through the admin menu.
-  ===== - Level 2 Headline =====+
  
-will be rendered+^ tier1   | heading level corresponding to the 1st tier | default = **2**((As I use a sidebar-index showing the first heading instead of the filename, I configured the plugin to start with the numbered headings from **H2** on. Otherwise the numbers would be shown in the index... but feel free to change the level to **1**.)) | 
 +^ format  | numbering format (used in vsprintf) of each tier, JSON array string  || 
 +^ fancy   | styled heading numbers | default = **off** |
  
-  3 Level 1 Headline +==== Auto-Detect first-tier level ====
-      3.1 Level 2 Headline+
  
 +When the config **tier1** is ''0'', the heading level where the numbered headings used first in the page will be set as **tier1** value in the page. You can use appropriate 1st-tier level in different pages.
  
-===== Configuration =====+==== Numbering format ====
  
-The plugin can be configured within the DokuWiki configuration manager available through the admin menu.+The config **format** defines tiered numbering style. Each tier format is the formatting string of [[phpfn>sprintf]], must be enclosed in double quotes (''%%"%%''). If //n//-th tier format is not defined, numbers are simply joined with period char. 
 +Some format examples:<file> 
 +["%d.", "%d.%d", "%d.%d.%d", "%d.%d.%d.%d", "%d.%d.%d.%d.%d"
 +["Chapter %d.", "Section %d.%d", "Subsection %d.%d.%d", "(%4$d)"
 +["Model %04d", "%04d-%02d"
 +</file>
  
-^ startlevel | level to start with numbered headings | default **2**((As I use a sidebar-index showing the first heading instead of the filename, I configured the plugin to start with the numbered headings from **H2** on. Otherwise the numbers would be shown in the index... but feel free to change the level to **1**.)) | +==== Control numbering feature ====
-^ tailingdot | show tailing dot after numbers (e.g. 1.2.) | default **0** |+
  
-The example above generates the following output when ''startlevel=2'' ''tailingdot=1'':+The numbered headings that are prefixed with "''%%--%%''" (instead of single "''%%-%%''") are not rendered, but can be used to specify level numbers or tier format.
  
-  Level 1 Headline +<file> 
-      1Level 2 Headline +assume config tier1 is set to 0 
-          1.1. Level 3 Headline +=== --#1000 ["(%04d)"] ===   ... set number and tier format of the level, invisible  
-          1.2Level 3 Headline +=== - item ===    → (1001) item 
-      2Level 2 Headline +=== -- ===             ... initialize tier1, format, headings counter 
-          2.1. Level 3 Headline +==== - item ====  → 1. item 2 
-  ...+</file>
  
-You can also override the startlevel in a per-page basis. Just insert this code to your page:+You can also override the first-tier level in a per-page basis. Just insert this code to your page:
 <code> <code>
 ~~HEADLINE NUMBERING FIRST LEVEL = n~~ ~~HEADLINE NUMBERING FIRST LEVEL = n~~
-{{startlevel>n}} (<- will be obsoleted in future release)  
 </code> </code>
  
 Where ''n'' is a number between 1 and 5, so your numbering will start in the heading level specified there. Where ''n'' is a number between 1 and 5, so your numbering will start in the heading level specified there.
- 
- 
- 
  
  
Line 96: Line 99:
  
 Since 2019-01-02, the plugin code has moved to github repository to provide better accessibility for install and further development opportunity. Thanks Lars J. Metz for your early work and encouraging me to move the code to github.  --- [[user>s.sahara|s.sahara]] //2019-01-02 03:40// Since 2019-01-02, the plugin code has moved to github repository to provide better accessibility for install and further development opportunity. Thanks Lars J. Metz for your early work and encouraging me to move the code to github.  --- [[user>s.sahara|s.sahara]] //2019-01-02 03:40//
- 
  
  
Line 104: Line 106:
  
  
-=== Revision List ===+=== Old Revision List ===
  
   * 2006-08-25 --- Published Plugin   * 2006-08-25 --- Published Plugin
plugin/numberedheadings.1546477192.txt.gz · Last modified: 2019-01-03 01:59 by s.sahara

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki