diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2022-10-07 12:09:14 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2022-10-07 12:09:14 +0000 |
commit | 703138af1e106f3862af4d743141e283d28a4d1c (patch) | |
tree | ac0fc6b4e3e65a521ac3aaa6000a8af7f020600c /wikilib.d/PmWiki.TableOfContents | |
parent | c31cc75d02ccdbf236d54c70fb5f61ce6d279ab4 (diff) | |
download | pmwiki.svn-703138af1e106f3862af4d743141e283d28a4d1c.tar.bz2 |
Documentation update.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4182 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'wikilib.d/PmWiki.TableOfContents')
-rw-r--r-- | wikilib.d/PmWiki.TableOfContents | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/wikilib.d/PmWiki.TableOfContents b/wikilib.d/PmWiki.TableOfContents index 123e994a..d7a7b24b 100644 --- a/wikilib.d/PmWiki.TableOfContents +++ b/wikilib.d/PmWiki.TableOfContents @@ -1,11 +1,11 @@ -version=pmwiki-2.3.5 ordered=1 urlencoded=1 +version=pmwiki-2.3.12 ordered=1 urlencoded=1 author=Petko charset=UTF-8 -csum=typo hlt css (-1) (+0) +csum=format (+0) (+0) ctime=1567101340 name=PmWiki.TableOfContents -rev=40 +rev=44 targets=Cookbook.AutoTOC,PmWiki.LayoutVariables,PmWiki.PathVariables -text=(:title Table of contents:)(:Audience: authors (basic) :)%0a(:Summary:Basic automatic table of contents and numbered headings:)%0aA basic table of contents (TOC) and Numbered headings (NH) are included in PmWiki 2.2.119 and can be enabled with the following in @@config.php@@:%0a%0a %25hlt php%25[@$PmTOC['Enable'] = 1;@]%0a%0a!! Usage [[#usage]]%0aThe feature is based on the recipe Cookbook:AutoTOC but is somewhat simpler. %0a%0a* The table of contents is automatic, there is no need to add some markup in the wiki page.%0a* It is inserted right before the first heading in the wiki page.%0a* By default, only pages with 3 or more headings will have a table of contents.%0a* The visitors can close or open the table of contents, and their last choice will be remembered by their browsers in "localStorage". It is then used also for other pages. And it is used, if the Wiki is revisited later, as long as the "localStorage" is not cleared in the meantime.%0a* The feature can automatically number the headings in the page.%0a* Headings in hidden sections ("comment" wikistyle, "display:none") will not be included in the TOC.%0a* Headings with the %25pmhlt%25[@%25block notoc%25@] class will not be included in the TOC.%0a* Headings in %25pmhlt%25[@(:markup:)@] blocks are ignored.%0a%0aThe following directives in the wiki page can control the above features:%0a%0a* %25pmhlt%25[@(:toc:)@] the table of contents will be inserted at this position (rather than the default one), even if there are less than 3 headings in the page.%0a* %25pmhlt%25[@(:notoc:)@] no table of contents will appear on the page, even if there are 3 or more headings, or a [@(:toc:)@] directive. If you have only one heading in a page, you may wish to use [@(:notoc:)@] to ''suppress numbering''.%0a* Both directives can be placed anywhere in a page, even in included pages such as a sidebar or a header.%0a* On a page with both %25pmhlt%25[@(:toc:)@] and [@(:notoc:)@] the latter wins and there will be no table of contents.%0a%0aThe TOC will use anchors or identifiers of the headings from the page, if they exist, otherwise it will create a new identifier (hash) based on the structure of the page. The following markups will all create a link with the anchor @@PageUrl%25blue%25#here%25%25@@:%0a%0a* %25pmhlt%25[@!! Heading with id %25block id=here%25@]%0a* %25pmhlt%25[@!! Heading with inline anchor [[#here]]@], or%0a* %25pmhlt%25[@!! [[#here]] Heading with inline anchor@]%0a* %25pmhlt%25[@[[#here]]@]\\%0a[@!! Anchor preceding the heading@]%0a%0aIf there is no identifier or anchor with a heading, then the anchor will be in the form @@%25blue%25#toc-1.2.1%25%25@@ where 1.2.1 is the structural path to the section, in this example "Section 1, subsection 2, sub-subsection 1".%0a%0a%0a!! Configuration [[#config]]%0aThe following local configuration (in @@2local/config.php@@) can control the default settings:%0a%0a* %25hlt php%25[@$PmTOC['Enable'] = 1; @]@@# enable TOC and/or NH, default is disabled.@@%0a* %25hlt php%25[@$PmTOC['MaxLevel'] = 6; @]@@# heading levels included in the TOC@@ \\%0a by default %25hlt html%25[@%3ch1>@] to [@%3ch6>@] are included. Set to 3 to only include [@%3ch1>@] to [@%3ch3>@].%0a* %25hlt php%25[@$PmTOC['MinNumber'] = 3; @]@@# minimum number of headings in the page for the TOC to be generated.@@ \\%0a Pages with few headings are usually short and do not need a TOC. %0a** %25hlt php%25[@$PmTOC['MinNumber'] = 2; @]@@# pages with 2+ headings will have a TOC@@%0a** %25hlt php%25[@$PmTOC['MinNumber'] = 9999999; @]@@# the TOC will not be automatic, only the (:toc:) directive will create a table of contents in the page. @@%0a%0a* %25hlt php%25[@$PmTOC['NumberedHeadings'] = '1.1.1.1.1.1'; @]@@# the headings will be numbered (default disabled).@@%0a** You can set here the numerals for the different levels of headings, can be 1 (numeric), I or i (Roman numerals), A or a (letters A-Z or a-z). For example, a specification like \\%0a %25hlt php%25[@[@$PmTOC['NumberedHeadings'] = 'I.1.a'; @] \\%0a will number the biggest level headings on a page with uppercase Roman numerals (I, II, ...), the second biggest with numbers, the third with lowercase letters (a, b, ...), and the remaining levels (if any) with numbers.%0a** %25hlt php%25[@$PmTOC['MinNumber'] = 9999999; @]@@# only enable Numbered headings without creating a TOC. You still need to set $PmTOC['Enable'] = 1;@@%0a%0a* %25hlt php%25[@$PmTOC['EnableBacklinks'] = 1; @]@@# insert after the headings "↑" arrows linking back to the table of contents (default disabled).@@%0a* %25hlt php%25[@$PmTOC['ParentElement'] = "#wikitext"; @]@@# the query selector of the parent HTML element where the TOC block to be inserted@@ \\%0a by default the TOC is inserted before the first heading; here you can select a different element. If selected, the TOC will be inserted in the element at the top. The %25pmhlt%25[@(:toc:)@] directive in the page can override this element.%0a%0a!! Internationalization [[#i18n]]%0a%0aThe following strings can be translated in XLPage, for example in French:%0a%0a "Contents" => "Sommaire",%0a "show" => "afficher",%0a "hide" => "masquer",%0a %0a!! Styles [[#styles]]%0aIf you prefer to see the TOC on the right side, you may want to insert the following in your $PubDirUrl/css/local.css file:%0a%0a%25hlt css%25[@.PmTOCdiv {%0a float: right;%0a margin-left: 5px;%0a }@]%0a%0aYou can modify the table elements font size and maximum table height by defining in your $PubDirUrl/css/local.css file:%0a%0a%25hlt ccs%25[@.PmTOCdiv { %0a font-size: 15px; %0a max-height: 600px;%0a }@]%0a%0aThe default font size is 13px and the default maximum height is 500px, you can define own values. When the table height exceeds the max-height value, there is a scrollbar (overflow:auto).%0a%0aSee also: Cookbook:AutoTOC. If you previously used AutoTOC you need to disable it when enabling $PmTOC.%0a -time=1654155298 +text=(:title Table of contents:)(:Audience: authors (basic) :)%0a(:Summary:Basic automatic table of contents and numbered headings:)%0aA basic table of contents (TOC) and Numbered headings (NH) are included in PmWiki 2.2.119 and can be enabled with the following in @@config.php@@:%0a%0a%25hlt php%25[@%0a$PmTOC['Enable'] = 1;%0a@]%0a%0a!! Usage [[#usage]]%0aThe feature is based on the recipe Cookbook:AutoTOC but is somewhat simpler. %0a%0a* The table of contents is automatic, there is no need to add some markup in the wiki page.%0a* It is inserted right before the first heading in the wiki page.%0a* By default, only pages with 3 or more headings will have a table of contents.%0a* The visitors can close or open the table of contents, and their last choice will be remembered by their browsers in "localStorage". It is then used also for other pages. And it is used, if the Wiki is revisited later, as long as the "localStorage" is not cleared in the meantime.%0a* The feature can automatically number the headings in the page.%0a* Headings in hidden sections ("comment" wikistyle, "display:none") will not be included in the TOC.%0a* Headings with the %25pmhlt%25[@%25block notoc%25@] class will not be included in the TOC.%0a* Headings in %25pmhlt%25[@(:markup:)@] blocks are ignored.%0a%0aThe following directives in the wiki page can control the above features:%0a%0a* %25pmhlt%25[@(:toc:)@] the table of contents will be inserted at this position (rather than the default one), even if there are less than 3 headings in the page.%0a* %25pmhlt%25[@(:notoc:)@] no table of contents will appear on the page, even if there are 3 or more headings, or a [@(:toc:)@] directive. If you have only one heading in a page, you may wish to use [@(:notoc:)@] to ''suppress numbering''.%0a* Both directives can be placed anywhere in a page, even in included pages such as a sidebar or a header.%0a* On a page with both %25pmhlt%25[@(:toc:)@] and [@(:notoc:)@] the latter wins and there will be no table of contents.%0a%0aThe TOC will use anchors or identifiers of the headings from the page, if they exist, otherwise it will create a new identifier (hash) based on the structure of the page. The following markups will all create a link with the anchor @@PageUrl%25blue%25#here%25%25@@:%0a%0a* %25pmhlt%25[@!! Heading with id %25block id=here%25@]%0a* %25pmhlt%25[@!! Heading with inline anchor [[#here]]@], or%0a* %25pmhlt%25[@!! [[#here]] Heading with inline anchor@]%0a* %25pmhlt%25[@[[#here]]@]\\%0a[@!! Anchor preceding the heading@]%0a%0aIf there is no identifier or anchor with a heading, then the anchor will be in the form @@%25blue%25#toc-1.2.1%25%25@@ where 1.2.1 is the structural path to the section, in this example "Section 1, subsection 2, sub-subsection 1".%0a%0a%0a!! Configuration [[#config]]%0aThe following local configuration (in @@local/config.php@@) can control the default settings:%0a%0a* %25hlt php%25[@$PmTOC['Enable'] = 1; @]@@# enable TOC and/or NH, default is disabled.@@%0a* %25hlt php%25[@$PmTOC['MaxLevel'] = 6; @]@@# heading levels included in the TOC@@ \\%0a by default %25hlt html%25[@%3ch1>@] to [@%3ch6>@] are included. Set to 3 to only include [@%3ch1>@] to [@%3ch3>@].%0a* %25hlt php%25[@$PmTOC['MinNumber'] = 3; @]@@# minimum number of headings in the page for the TOC to be generated.@@ \\%0a Pages with few headings are usually short and do not need a TOC. %0a** %25hlt php%25[@$PmTOC['MinNumber'] = 2; @]@@# pages with 2+ headings will have a TOC@@%0a** %25hlt php%25[@$PmTOC['MinNumber'] = 9999999; @]@@# the TOC will not be automatic, only the (:toc:) directive will create a table of contents in the page. @@%0a%0a* %25hlt php%25[@$PmTOC['NumberedHeadings'] = '1.1.1.1.1.1'; @]@@# the headings will be numbered (default disabled).@@%0a** You can set here the numerals for the different levels of headings, can be 1 (numeric), I or i (Roman numerals), A or a (letters A-Z or a-z). For example, a specification like \\%0a %25hlt php%25[@$PmTOC['NumberedHeadings'] = 'I.1.a'; @] \\%0a will number the biggest level headings on a page with uppercase Roman numerals (I, II, ...), the second biggest with numbers, the third with lowercase letters (a, b, ...), and the remaining levels (if any) with numbers.%0a** %25hlt php%25[@$PmTOC['MinNumber'] = 9999999; @]@@# only enable Numbered headings without creating a TOC. You still need to set $PmTOC['Enable'] = 1;@@%0a%0a* %25hlt php%25[@$PmTOC['EnableBacklinks'] = 1; @]@@# insert after the headings "↑" arrows linking back to the table of contents (default disabled).@@%0a* %25hlt php%25[@$PmTOC['ParentElement'] = "#wikitext"; @]@@# the query selector of the parent HTML element where the TOC block to be inserted@@ \\%0a by default the TOC is inserted before the first heading; here you can select a different element. If selected, the TOC will be inserted in the element at the top. The %25pmhlt%25[@(:toc:)@] directive in the page can override this element.%0a%0a!! Internationalization [[#i18n]]%0a%0aThe following strings can be translated in XLPage, for example in French:%0a%0a "Contents" => "Sommaire",%0a "show" => "afficher",%0a "hide" => "masquer",%0a %0a!! Styles [[#styles]]%0aIf you prefer to see the TOC on the right side, you may want to insert the following in your $PubDirUrl/css/local.css file:%0a%0a%25hlt css%25[@.PmTOCdiv {%0a float: right;%0a margin-left: 5px;%0a }@]%0a%0aYou can modify the table elements font size and maximum table height by defining in your $PubDirUrl/css/local.css file:%0a%0a%25hlt ccs%25[@.PmTOCdiv { %0a font-size: 15px; %0a max-height: 600px;%0a }@]%0a%0aThe default font size is 13px and the default maximum height is 500px, you can define own values. When the table height exceeds the max-height value, there is a scrollbar (overflow:auto).%0a%0aSee also: Cookbook:AutoTOC. If you previously used AutoTOC you need to disable it when enabling $PmTOC.%0a +time=1664938374 title=Table of contents |