Skip to content

Commit 02eb177

Browse files
committed
Add README generation workflow
1 parent 0e276d4 commit 02eb177

4 files changed

Lines changed: 250 additions & 2 deletions

File tree

.distignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ phpcs.xml.dist
1010
.gitignore
1111
.gitattributes
1212
.editorconfig
13-
.wp-env.json
13+
.wp-env.json
14+
README.md

.github/workflows/readme.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Update README
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
paths-ignore:
8+
- 'README.md'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
concurrency:
15+
group: readme-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
readme:
20+
name: Convert WordPress readme to Markdown
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v5
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v5
31+
with:
32+
node-version: 20
33+
34+
- name: Generate README.md
35+
run: npx --yes wp-readme-to-markdown@1.0.1
36+
37+
- name: Commit README.md
38+
run: |
39+
if [ -z "$(git status --porcelain -- README.md)" ]; then
40+
echo "README.md is already up to date."
41+
exit 0
42+
fi
43+
44+
git config user.name "github-actions[bot]"
45+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
46+
git add README.md
47+
git commit -m "Update README.md from readme.txt"
48+
git push origin HEAD:${GITHUB_REF_NAME}

README.md

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# SimpleTOC - Table of Contents Block #
2+
**Contributors:** [MarcDK](https://profiles.wordpress.org/MarcDK/)
3+
**Tags:** TOC, Table of Contents, Block, Accessibility, Table
4+
**Requires at least:** 5.9
5+
**Tested up to:** 6.9
6+
**Stable tag:** 7.0.4
7+
**Requires PHP:** 7.3
8+
**License:** GPLv2 or later
9+
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
10+
**Donate link:** https://marc.tv/out/donate
11+
12+
SEO-friendly Table of Contents Gutenberg block. No JavaScript or CSS by default.
13+
14+
## Description ##
15+
16+
Add a Table of Contents block to your posts and pages. The TOC is a nested list of links to all heading found in the post or page. To use it, simply add a block and search for "SimpleTOC" or just "TOC".
17+
18+
The maximum depth of the toc can be configured in in the blocks' sidebar among many other options. There can hide the headline "Table of Contents" and add your own by using a normal heading block.
19+
20+
[Spin up](https://demo.tastewp.com/simpletoc) a new WordPress instance with the SimpleTOC plugin already installed.
21+
22+
### User Feedback ###
23+
24+
> "It is lightweight, stable, and fully compatible with WordPress Full Site Editing. A reliable solution that integrates seamlessly and performs exactly as expected."
25+
[@js100 on wordpress.org](https://wordpress.org/support/topic/good-job-1889/)
26+
27+
> "Does the job perfectly, and adds no bloat."
28+
[@clicknathan on wordpress.org](https://wordpress.org/support/topic/does-the-job-perfectly-and-adds-no-bloat/)
29+
30+
> "Simple yet powerful. Great plugin that does exactly what you need."
31+
[@mixey on wordpress.org](https://wordpress.org/support/topic/simple-yet-powerful-106/)
32+
33+
### Accessibility ###
34+
35+
This plugin is designed & developed for WCAG 2.2 level AA conformance. The plugin is tested with assistive technology and intended to be accessible, however some third party plugins or themes may affect the individual accessibility on a given website. If you find an accessibility issue, please [let us know](https://github.com/mtoensing/simpletoc/issues) and we'll try to address it promptly.
36+
Hidden TOCs use native `<details>` and `<summary>` semantics without extra ARIA references that require custom IDs.
37+
38+
### Features ###
39+
40+
* Designed for Gutenberg.
41+
* Zero configuration: Add the SimpleTOC block to your post and that's it.
42+
* Minimal and valid HTML output.
43+
* Utilizes the browser's built-in details tag for a collapsible interface.
44+
* No JavaScript or CSS by default. Optional features such as the accordion menu, smooth scrolling, or box style add minimal assets only when enabled.
45+
* Optional box style for the TOC with a default gray background.
46+
* Style SimpleTOC with Gutenberg's native group styling options.
47+
* Inherits the style of your theme.
48+
* Smooth scrolling effect using CSS.
49+
* Accessibility built-in by following web standards.
50+
* Optional ARIA Label and navigation role attributes.
51+
* Translated in [multiple languages](https://translate.wordpress.org/projects/wp-plugins/simpletoc/). Including German, Japanese, Chinese (Taiwan), Dutch, Brazilian Portuguese, French, Spanish and Latvia.
52+
* Ideal for creating a Frequently Asked Questions section on your website.
53+
54+
### Customization ###
55+
56+
* Administrators can utilize global settings to supersede the individual block settings.
57+
* Add background and text color with Gutenberg groups.
58+
* Native block support for wide and full width.
59+
* Control the maximum depth of the headings.
60+
* Choose between an ordered, bullet HTML list. Or indent the list.
61+
* Enable a box style and choose a box color directly in the block sidebar.
62+
* Select a heading level or turn it into a paragraph.
63+
* Disable the h2 heading of the TOC block and add your own.
64+
65+
### Compatibility ###
66+
67+
* GeneratePress and Rank Math support.
68+
* Works with popular AMP plugins.
69+
70+
### How to contribute ###
71+
72+
SimpleTOC is open-source and developed on [GitHub Pages](https://github.com/mtoensing/SimpleTOC). If you find a bug or have an idea for a feature please feel free to contribute and create a pull request.
73+
74+
## Changelog ##
75+
76+
### 7.0.4 ###
77+
* Fixed: GenerateBlocks dynamic tags in heading links keep working when SimpleTOC adds heading IDs.
78+
* Fixed: GenerateBlocks dynamic heading text is resolved consistently in the TOC and matching heading anchors.
79+
80+
### 7.0.3 ###
81+
* Fixed: Removed an invalid `aria-labelledby` reference from hidden TOC `<details>` markup and now rely on native `<summary>` labeling.
82+
83+
### 7.0.2 ###
84+
* Fixed: Removed an invalid `aria-labelledby` reference from hidden TOC `<details>` markup and now rely on native `<summary>` labeling.
85+
86+
### 7.0.1 ###
87+
* Added: Direct link from the Advanced Features sidebar to the global SimpleTOC settings.
88+
* Fixed: Global settings link now appears reliably in the editor sidebar.
89+
* Changed: Wrapper toggle now reflects the automatic wrapper state while box style is active.
90+
91+
### 7.0.0 ###
92+
* Added: Box style option in the block sidebar with a color picker and default gray background.
93+
* Added: Global setting to force the default gray box style for all SimpleTOC blocks.
94+
* Added: Frontend box-style CSS registered through block metadata.
95+
96+
### 6.9.8 ###
97+
* Updated: Dependencies and house-keeping.
98+
* Fix: corrected dependency declarations.
99+
100+
### 6.9.7 ###
101+
* Fixed: GeneratePress Dynamic Tags work again - hopefully. If not, please report here https://github.com/mtoensing/simpletoc/issues/79#issuecomment-3745650464 Thanks @jhanten
102+
103+
### 6.9.6 ###
104+
* Added: Coding standards cleanup with improved rules, cleaner code, safer output, and consistent naming. Thanks @ronalfy
105+
* Added: Minimum PHP version requirement set to 7.3
106+
107+
### 6.9.4 ###
108+
* Added: Introduced proper PHP namespaces to avoid class and function name conflicts and improve overall code robustness. Thanks @ronalfy.
109+
* Added: Improved sidebar sub-menu for the “Hide SimpleTOC” option
110+
111+
### 6.9.3 ###
112+
* Fix: Fix Multiple IDs in Table of Contents Thanks @ronalfy
113+
* Added: Support for GenerateBlocks 2.1.0 Thanks @ronalfy
114+
115+
### 6.9.1 ###
116+
* Added: Support for the new V3 block api.
117+
* Added: Tested compatibility with WordPress 6.9
118+
119+
### 6.7.3 ###
120+
* Added: Tested compatibility with WordPress 6.8
121+
122+
### 6.7.2 ###
123+
* Added: Support for GenerateBlocks 2.0. Thanks @blronaldhuereca
124+
* Added: Included an accessibility statement in the plugin description. Thanks Gen Herres.
125+
126+
## Installation ##
127+
128+
SimpleTOC can be found and installed via the Plugin menu within WordPress administration (Plugins -> Add New). Alternatively, it can be downloaded from WordPress.org and installed manually...
129+
130+
In Gutenberg, add a block and search for "SimpleTOC" or just "TOC". Please save your content before you use the block.
131+
132+
## Frequently Asked Questions ##
133+
134+
### Configuring Global Settings in SimpleTOC ###
135+
136+
SimpleTOC allows you to configure global settings for your WordPress website. These settings can be enforced globally, overriding any block-level configurations that may exist. To access these settings, navigate to the SimpleTOC section of the WordPress Settings.
137+
138+
### How do I add a background color to SimpleTOC using Gutenberg groups? ###
139+
140+
Select the block and select "group" in the context menu. Apply "background color", "link color" and "text color" to this group. SimpleTOC will inherit these styles. You would like to use this styled SimpleTOC group next time you write a post? Convert it to a reusable block.
141+
142+
### How to exclude a single heading from the TOC? ###
143+
144+
If you really want to hide a single heading from the table of contents, then add the CSS class "simpletoc-hidden" to a heading block. You can find this field in the same place as the HTML anchor field: In the Block > Advanced sidebar. But first, think about the reason you would like to hide a specific heading. Maybe you would like to remove all headings of a specific depth level. Then there is an option for that in the blocks options in Gutenberg. If you think this heading should not be part of the toc perhaps it is not needed in the post itself?
145+
146+
### I would like to save my SimpleTOC settings as default. Is that possible? ###
147+
148+
You can convert your configured SimpleTOC block into a reusable block in Gutenberg. It will keep its settings. This way, you can use your desired settings for each new post by adding the reusable block.
149+
150+
### How to add a div tag wrapper to the TOC? ###
151+
152+
If you add a custom class to the SimpleTOC block in "Advanced" and then "Additional CSS Class(es)" a div with that class will be wrapped around the HTML output.
153+
154+
### How to allow developers to exclude specific headings programmatically? ###
155+
156+
Use the 'simpletoc_excluded_blocks' filter. For example, this code will exclude heading blocks that are inside a column block.
157+
158+
Example:
159+
160+
add_filter( 'simpletoc_excluded_blocks', function ( array $blocks ) {
161+
$blocks[] = 'core/column';
162+
163+
return $blocks;
164+
} );
165+
166+
167+
### How do I change the color of the accordion menu? ###
168+
169+
The heavy plus character I used can not be colored with css without hacks. But you can change the icon to something else and change the color of the new icon.
170+
171+
.simpletoc-collapsible::after {
172+
content: "✖";
173+
color: #e94c89;
174+
}
175+
176+
### How do I add SimpleTOC to all articles automatically? ###
177+
178+
I don’t see an easy solution at the moment. SimpleTOC is only a block that can be placed in your post. If there was a plugin that adds blocks to every post, then this would be the solution. I think this should be another separate plug-in to keep the code of SimpleTOC clean and … well, simple.
179+
180+
## Screenshots ##
181+
1. SimpleTOC block in Gutenberg editor.
182+
2. SimpleTOC in the post.
183+
3. Simple but powerful. Customize each TOC as you like.
184+
4. Control the maximum depth of the headings.
185+
5. SimpleTOC styled with Gutenbergs native group styles.
186+
6. SimpleTOC Advanced Features
187+
7. Gutenberg Heading block: Set a custom anchor
188+
8. SimpleTOC hidden in the accordion menu.
189+
9. SimpleTOC global settings.
190+
191+
## Credits ##
192+
193+
This plugin is forked from [pdewouters](https://github.com/pdewouters/gutentoc) and uses code from [Easy-Table-of-Contents](https://github.com/shazahm1/Easy-Table-of-Contents)
194+
195+
Many thanks to [Tom J Nowell](https://tomjn.com) and and Sally CJ who both helped me a lot with my questions over at wordpress.stackexchange.com
196+
197+
And many more thanks to all the [developers on GitHub](https://github.com/mtoensing/simpletoc/graphs/contributors) who helped me making SimpleTOC what it is today!
198+
199+
Thanks to Quintus Valerius Soranus for inventing the Table of Contents around 100 BC.

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Select the block and select "group" in the context menu. Apply "background color
143143

144144
If you really want to hide a single heading from the table of contents, then add the CSS class "simpletoc-hidden" to a heading block. You can find this field in the same place as the HTML anchor field: In the Block > Advanced sidebar. But first, think about the reason you would like to hide a specific heading. Maybe you would like to remove all headings of a specific depth level. Then there is an option for that in the blocks options in Gutenberg. If you think this heading should not be part of the toc perhaps it is not needed in the post itself?
145145

146-
= I would like to save my SimpleTOC settings as default. Is that possible?
146+
= I would like to save my SimpleTOC settings as default. Is that possible? =
147147

148148
You can convert your configured SimpleTOC block into a reusable block in Gutenberg. It will keep its settings. This way, you can use your desired settings for each new post by adding the reusable block.
149149

0 commit comments

Comments
 (0)