Skip to content

Commit b291e88

Browse files
committed
ADD TO: publish action / auto-generate table of contents
1 parent 87dba52 commit b291e88

13 files changed

+50
-205
lines changed

.github/workflows/publish-wiki.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,19 @@ jobs:
3838
- name: Checkout code
3939
uses: actions/checkout@v4
4040

41+
- name: Install DocToc table of contents generator
42+
run: npm install -g doctoc
43+
4144
- name: Copy wiki files to temporary location
4245
shell: bash
4346
run: cp -v -a wiki _wiki
4447

48+
- name: Update tables of contents
49+
run: doctoc ./_wiki/ --github --maxlevel 4 --update-only
50+
51+
- name: Re-run tables of contents with different settings for specific file
52+
run: doctoc ./_wiki/Version-4.0-User-Upgrade-Guide.md --github --maxlevel 3 --update-only
53+
4554
- name: Deploy to wiki
4655
uses: Andrew-Chen-Wang/github-wiki-action@v4
4756
with:

.markdownlint-cli2.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ config:
3838
MD031: false
3939
# MD032/blanks-around-lists - Lists should be surrounded by blank lines.
4040
MD032: false
41+
# MD036/no-emphasis-as-heading : Emphasis used instead of a heading.
42+
# Disabled as this is used as a "hack" to exclude select headers from the automatic Table of Contents creation.
43+
MD036: false
4144
# MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading.
4245
MD041: false
4346

wiki/About-Standards-for-PHP_CodeSniffer.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
## Table of contents
22

3-
* [A Project ruleset or a standard ?](#a-project-ruleset-or-a-standard-)
4-
* [How does PHP_CodeSniffer determine which standard or ruleset to apply ?](#how-does-php_codesniffer-determine-which-standard-or-ruleset-to-apply-)
5-
* [About standards](#about-standards)
6-
* [Creating an external standard for PHP_CodeSniffer](#creating-an-external-standard-for-php_codesniffer)
7-
* [Creating new rules](#creating-new-rules)
8-
* [Naming conventions](#naming-conventions)
9-
* [1. Directory structure](#1-directory-structure)
10-
* [2. Sniff file name](#2-sniff-file-name)
11-
* [3. Namespace and class name](#3-namespace-and-class-name)
12-
* [Examples](#examples)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
135

146
***
157

wiki/Advanced-Usage.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
## Table of contents
22

3-
* [Specifying Valid File Extensions](#specifying-valid-file-extensions)
4-
* [Ignoring Files and Folders](#ignoring-files-and-folders)
5-
* [Ignoring Parts of a File](#ignoring-parts-of-a-file)
6-
* [Limiting Results to Specific Sniffs](#limiting-results-to-specific-sniffs)
7-
* [Filtering Errors and Warnings Based on Severity](#filtering-errors-and-warnings-based-on-severity)
8-
* [Replacing Tabs with Spaces](#replacing-tabs-with-spaces)
9-
* [Specifying an Encoding](#specifying-an-encoding)
10-
* [Using a Bootstrap File](#using-a-bootstrap-file)
11-
* [Using a Default Configuration File](#using-a-default-configuration-file)
12-
* [Specifying php.ini Settings](#specifying-phpini-settings)
13-
* [Setting Configuration Options](#setting-configuration-options)
14-
* [Deleting Configuration Options](#deleting-configuration-options)
15-
* [Viewing Configuration Options](#viewing-configuration-options)
16-
* [Printing Verbose Tokeniser Output](#printing-verbose-tokeniser-output)
17-
* [The Scope Map](#the-scope-map)
18-
* [The Level Map](#the-level-map)
19-
* [Printing Verbose Token Processing Output](#printing-verbose-token-processing-output)
20-
* [Quieting Output](#quieting-output)
21-
* [Understanding the Exit Codes](#understanding-the-exit-codes)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
225

236
***
247

wiki/Coding-Standard-Tutorial.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ In this tutorial, we will create a new coding standard with a single sniff. Our
22

33
Sniffs need to follow [strict directory layout and naming conventions](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/About-Standards-for-PHP_CodeSniffer#naming-conventions).
44

5+
## Table of contents
6+
7+
<!-- START doctoc -->
8+
<!-- END doctoc -->
9+
10+
***
11+
512
## Creating the Coding Standard Directory
613

714
All sniffs in PHP_CodeSniffer must belong to a coding standard. A coding standard is a directory with a specific sub-directory structure and a `ruleset.xml` file, so creating a standard is straight-forward.

wiki/Configuration-Options.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
## Table of contents
22

3-
* [Setting the default coding standard](#setting-the-default-coding-standard)
4-
* [Setting the default report format](#setting-the-default-report-format)
5-
* [Hiding warnings by default](#hiding-warnings-by-default)
6-
* [Showing progress by default](#showing-progress-by-default)
7-
* [Using colors in output by default](#using-colors-in-output-by-default)
8-
* [Changing the default severity levels](#changing-the-default-severity-levels)
9-
* [Setting the default report width](#setting-the-default-report-width)
10-
* [Setting the default encoding](#setting-the-default-encoding)
11-
* [Setting the default tab width](#setting-the-default-tab-width)
12-
* [Setting the installed standard paths](#setting-the-installed-standard-paths)
13-
* [Setting the PHP version](#setting-the-php-version)
14-
* [Ignoring errors when generating the exit code](#ignoring-errors-when-generating-the-exit-code)
15-
* [Ignoring warnings when generating the exit code](#ignoring-warnings-when-generating-the-exit-code)
16-
* [Ignoring non-auto-fixable issues when generating the exit code (PHP_CodeSniffer >= 4.0.0)](#ignoring-non-auto-fixable-issues-when-generating-the-exit-code-php_codesniffer--400)
17-
* Setting tool paths
18-
* [CSSLint](#setting-the-path-to-csslint)
19-
* [Google Closure Linter](#setting-the-path-to-the-google-closure-linter)
20-
* [PHP](#setting-the-path-to-php)
21-
* [JSHint](#setting-the-path-to-jshint)
22-
* [JSLint](#setting-the-path-to-jslint)
23-
* [JavaScript Lint](#setting-the-path-to-javascript-lint)
24-
* [Zend Code Analyzer](#setting-the-path-to-the-zend-code-analyzer)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
255

266
***
277

wiki/Customisable-Sniff-Properties.md

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,8 @@ For more information about changing sniff behaviour by customising your ruleset,
44

55
## Table of contents
66

7-
* [Generic Sniffs](#generic-sniffs)
8-
* [Generic.Arrays.ArrayIndent](#genericarraysarrayindent)
9-
* [Generic.CodeAnalysis.UnusedFunctionParameter](#genericcodeanalysisunusedfunctionparameter)
10-
* [Generic.ControlStructures.InlineControlStructure](#genericcontrolstructuresinlinecontrolstructure)
11-
* [Generic.Debug.ClosureLinter](#genericdebugclosurelinter)
12-
* [Generic.Debug.ESLint](#genericdebugeslint)
13-
* [Generic.Files.LineEndings](#genericfileslineendings)
14-
* [Generic.Files.LineLength](#genericfileslinelength)
15-
* [Generic.Formatting.MultipleStatementAlignment](#genericformattingmultiplestatementalignment)
16-
* [Generic.Formatting.SpaceAfterCast](#genericformattingspaceaftercast)
17-
* [Generic.Formatting.SpaceAfterNot](#genericformattingspaceafternot)
18-
* [Generic.Functions.OpeningFunctionBraceBsdAllman](#genericfunctionsopeningfunctionbracebsdallman)
19-
* [Generic.Functions.OpeningFunctionBraceKernighanRitchie](#genericfunctionsopeningfunctionbracekernighanritchie)
20-
* [Generic.Metrics.CyclomaticComplexity](#genericmetricscyclomaticcomplexity)
21-
* [Generic.Metrics.NestingLevel](#genericmetricsnestinglevel)
22-
* [Generic.NamingConventions.CamelCapsFunctionName](#genericnamingconventionscamelcapsfunctionname)
23-
* [Generic.PHP.ForbiddenFunctions](#genericphpforbiddenfunctions)
24-
* [Generic.PHP.NoSilencedErrors](#genericphpnosilencederrors)
25-
* [Generic.Strings.UnnecessaryStringConcat](#genericstringsunnecessarystringconcat)
26-
* [Generic.WhiteSpace.ArbitraryParenthesesSpacing](#genericwhitespacearbitraryparenthesesspacing)
27-
* [Generic.WhiteSpace.ScopeIndent](#genericwhitespacescopeindent)
28-
* [Generic.WhiteSpace.SpreadOperatorSpacingAfter](#genericwhitespacespreadoperatorspacingafter)
29-
* [PEAR Sniffs](#pear-sniffs)
30-
* [PEAR.Commenting.FunctionComment](#pearcommentingfunctioncomment)
31-
* [PEAR.ControlStructures.ControlSignature](#pearcontrolstructurescontrolsignature)
32-
* [PEAR.ControlStructures.MultiLineCondition](#pearcontrolstructuresmultilinecondition)
33-
* [PEAR.Formatting.MultiLineAssignment](#pearformattingmultilineassignment)
34-
* [PEAR.Functions.FunctionCallSignature](#pearfunctionsfunctioncallsignature)
35-
* [PEAR.Functions.FunctionDeclaration](#pearfunctionsfunctiondeclaration)
36-
* [PEAR.WhiteSpace.ObjectOperatorIndent](#pearwhitespaceobjectoperatorindent)
37-
* [PEAR.WhiteSpace.ScopeClosingBrace](#pearwhitespacescopeclosingbrace)
38-
* [PEAR.WhiteSpace.ScopeIndent](#pearwhitespacescopeindent)
39-
* [PSR2 Sniffs](#psr2-sniffs)
40-
* [PSR2.Classes.ClassDeclaration](#psr2classesclassdeclaration)
41-
* [PSR2.ControlStructures.ControlStructureSpacing](#psr2controlstructurescontrolstructurespacing)
42-
* [PSR2.ControlStructures.SwitchDeclaration](#psr2controlstructuresswitchdeclaration)
43-
* [PSR2.Methods.FunctionCallSignature](#psr2methodsfunctioncallsignature)
44-
* [PSR12 Sniffs](#psr12-sniffs)
45-
* [PSR12.Classes.AnonClassDeclaration](#psr12classesanonclassdeclaration)
46-
* [PSR12.ControlStructures.BooleanOperatorPlacement](#psr12controlstructuresbooleanoperatorplacement)
47-
* [PSR12.ControlStructures.ControlStructureSpacing](#psr12controlstructurescontrolstructurespacing)
48-
* [PSR12.Namespaces.CompoundNamespaceDepth](#psr12namespacescompoundnamespacedepth)
49-
* [PSR12.Operators.OperatorSpacing](#psr12operatorsoperatorspacing)
50-
* [Squiz Sniffs](#squiz-sniffs)
51-
* [Squiz.Classes.ClassDeclaration](#squizclassesclassdeclaration)
52-
* [Squiz.Commenting.FunctionComment](#squizcommentingfunctioncomment)
53-
* [Squiz.Commenting.LongConditionClosingComment](#squizcommentinglongconditionclosingcomment)
54-
* [Squiz.ControlStructures.ControlSignature](#squizcontrolstructurescontrolsignature)
55-
* [Squiz.ControlStructures.ForEachLoopDeclaration](#squizcontrolstructuresforeachloopdeclaration)
56-
* [Squiz.ControlStructures.ForLoopDeclaration](#squizcontrolstructuresforloopdeclaration)
57-
* [Squiz.ControlStructures.SwitchDeclaration](#squizcontrolstructuresswitchdeclaration)
58-
* [Squiz.CSS.ForbiddenStyles](#squizcssforbiddenstyles)
59-
* [Squiz.CSS.Indentation](#squizcssindentation)
60-
* [Squiz.Functions.FunctionDeclaration](#squizfunctionsfunctiondeclaration)
61-
* [Squiz.Functions.FunctionDeclarationArgumentSpacing](#squizfunctionsfunctiondeclarationargumentspacing)
62-
* [Squiz.PHP.CommentedOutCode](#squizphpcommentedoutcode)
63-
* [Squiz.PHP.DiscouragedFunctions](#squizphpdiscouragedfunctions)
64-
* [Squiz.PHP.ForbiddenFunctions](#squizphpforbiddenfunctions)
65-
* [Squiz.Strings.ConcatenationSpacing](#squizstringsconcatenationspacing)
66-
* [Squiz.WhiteSpace.FunctionSpacing](#squizwhitespacefunctionspacing)
67-
* [Squiz.WhiteSpace.MemberVarSpacing](#squizwhitespacemembervarspacing)
68-
* [Squiz.WhiteSpace.ObjectOperatorSpacing](#squizwhitespaceobjectoperatorspacing)
69-
* [Squiz.WhiteSpace.OperatorSpacing](#squizwhitespaceoperatorspacing)
70-
* [Squiz.WhiteSpace.SuperfluousWhitespace](#squizwhitespacesuperfluouswhitespace)
7+
<!-- START doctoc -->
8+
<!-- END doctoc -->
719

7210
***
7311

wiki/FAQ.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
## Table of contents
22

3-
* [Does PHP_CodeSniffer perform any code coverage or unit testing?](#does-php_codesniffer-perform-any-code-coverage-or-unit-testing)
4-
* [My code is fine! Why do I need PHP_CodeSniffer?](#my-code-is-fine-why-do-i-need-php_codesniffer)
5-
* [Does PHP_CodeSniffer parse my code to ensure it will execute?](#does-php_codesniffer-parse-my-code-to-ensure-it-will-execute)
6-
* [I don't agree with your coding standards! Can I make PHP_CodeSniffer enforce my own?](#i-dont-agree-with-your-coding-standards-can-i-make-php_codesniffer-enforce-my-own)
7-
* [How come PHP_CodeSniffer reported errors, I fixed them, now I get even more?](#how-come-php_codesniffer-reported-errors-i-fixed-them-now-i-get-even-more)
8-
* [What does PHP_CodeSniffer use to tokenize my code?](#what-does-php_codesniffer-use-to-tokenize-my-code)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
95

106
***
117

wiki/Fixing-Errors-Automatically.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
## Table of contents
22

3-
* [About Automatic Fixing](#about-automatic-fixing)
4-
* [Using the PHP Code Beautifier and Fixer](#using-the-php-code-beautifier-and-fixer)
5-
* [Viewing Debug Information](#viewing-debug-information)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
65

76
***
87

wiki/Usage.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
## Table of contents
22

3-
* [Getting Help from the Command Line](#getting-help-from-the-command-line)
4-
* [Checking Files and Folders](#checking-files-and-folders)
5-
* [Printing a Summary Report](#printing-a-summary-report)
6-
* [Printing Progress Information](#printing-progress-information)
7-
* [Specifying a Coding Standard](#specifying-a-coding-standard)
8-
* [Printing a List of Installed Coding Standards](#printing-a-list-of-installed-coding-standards)
9-
* [Listing Sniffs Inside a Coding Standard](#listing-sniffs-inside-a-coding-standard)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
105

116
***
127

wiki/Version-3.0-Upgrade-Guide.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,8 @@ PHP_CodeSniffer version 3 contains a large number of core changes and breaks bac
77

88
## Table of contents
99

10-
* [Upgrading Custom Sniffs](#upgrading-custom-sniffs)
11-
* [Extending Other Sniffs](#extending-other-sniffs)
12-
* [Extending the Included Abstract Sniffs](#extending-the-included-abstract-sniffs)
13-
* [AbstractVariableSniff](#abstractvariablesniff)
14-
* [AbstractPatternSniff](#abstractpatternsniff)
15-
* [AbstractScopeSniff](#abstractscopesniff)
16-
* [New Class Names](#new-class-names)
17-
* [PHP_CodeSniffer_File](#php_codesniffer_file)
18-
* [PHP_CodeSniffer_Tokens](#php_codesniffer_tokens)
19-
* [PHP_CodeSniffer](#php_codesniffer)
20-
* [Upgrading Unit Tests](#upgrading-unit-tests)
21-
* [Setting CLI Values](#setting-cli-values)
22-
* [Upgrading Custom Reports](#upgrading-custom-reports)
23-
* [Supporting Concurrency](#supporting-concurrency)
10+
<!-- START doctoc -->
11+
<!-- END doctoc -->
2412

2513
***
2614

0 commit comments

Comments
 (0)