| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | === SimpleTOC - Table of Contents Block === |
| 2 | 2 | Contributors: MarcDK |
| 3 | 3 | Tags: TOC, Table of Contents, Block, Accessibility, Table |
| 4 | -Requires at least: 5.9 | |
| 5 | -Tested up to: 7.0 | |
| 6 | -Stable tag: 7.0.6 | |
| 4 | +Requires at least: 6.2 | |
| 5 | +Tested up to: 7.1 | |
| 6 | +Stable tag: 7.4.0 | |
| 7 | 7 | Requires PHP: 7.3 |
| 8 | 8 | License: GPLv2 or later |
| 9 | 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 10 | 10 | Donate link: https://marc.tv/out/donate |
| @@ -41,14 +41,15 @@ | ||
| 41 | 41 | * Zero configuration: Add the SimpleTOC block to your post and that's it. |
| 42 | 42 | * Minimal and valid HTML output. |
| 43 | 43 | * Utilizes the browser's built-in details tag for a collapsible interface. |
| 44 | 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. | |
| 45 | +* Optional Box style in Gutenberg's Styles tab with a default gray background. | |
| 46 | +* Native text, link, background, spacing, and typography controls. | |
| 47 | +* Global block styling through theme.json. | |
| 47 | 48 | * Inherits the style of your theme. |
| 48 | 49 | * Smooth scrolling effect using CSS. |
| 49 | 50 | * Accessibility built-in by following web standards. |
| 50 | -* Optional ARIA Label and navigation role attributes. | |
| 51 | +* Standard Gutenberg block wrapper with navigation role and ARIA label attributes. | |
| 51 | 52 | * 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 | 53 | * Ideal for creating a Frequently Asked Questions section on your website. |
| 53 | 54 | |
| 54 | 55 | = Customization = |
| @@ -53,16 +54,23 @@ | ||
| 53 | 54 | |
| 54 | 55 | = Customization = |
| 55 | 56 | |
| 56 | 57 | * Administrators can utilize global settings to supersede the individual block settings. |
| 57 | -* Add background and text color with Gutenberg groups. | |
| 58 | +* Set text, link, and background colors in Gutenberg's Styles tab. | |
| 58 | 59 | * Native block support for wide and full width. |
| 60 | +* Set vertical margins and padding with native spacing controls. | |
| 59 | 61 | * Control the maximum depth of the headings. |
| 60 | 62 | * 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. | |
| 63 | +* Select the Box style directly in Gutenberg's Styles tab. | |
| 62 | 64 | * Select a heading level or turn it into a paragraph. |
| 63 | 65 | * Disable the h2 heading of the TOC block and add your own. |
| 64 | 66 | |
| 67 | += Highlight the current section = | |
| 68 | + | |
| 69 | +Enable "Highlight current section" under Advanced Features in the SimpleTOC block settings. The link for the current section is underlined as visitors scroll. This option is off by default. To enable it for all blocks, turn on "Force highlight current section" under Settings > SimpleTOC. The global setting takes precedence over individual block settings. Developers can override the global setting with the `simpletoc_scroll_spy_enabled` filter. | |
| 70 | + | |
| 71 | +This feature uses native CSS `scroll-target-group` and `:target-current`. Browser support is limited. Browsers without support keep the normal table of contents and working links. No JavaScript fallback or polyfill is included. Highlighting applies to headings on the current page and does not make the table of contents sticky. | |
| 72 | + | |
| 65 | 73 | = Compatibility = |
| 66 | 74 | |
| 67 | 75 | * GeneratePress and Rank Math support. |
| 68 | 76 | * Works with popular AMP plugins. |
| @@ -71,67 +79,11 @@ | ||
| 71 | 79 | |
| 72 | 80 | 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 | 81 | |
| 74 | 82 | == Changelog == |
| 75 | -= 7.0.6 = | |
| 76 | -* Prepared release for WordPress 7.0 compatibility. | |
| 83 | += 7.4.0 = | |
| 84 | +* Added: Optional CSS-only scroll spy to underline the current section link in supporting browsers. Enable Highlight current section in the block settings or enforce it globally under Settings > SimpleTOC. No JavaScript or polyfill is added. | |
| 77 | 85 | |
| 78 | - | |
| 79 | -= 7.0.5 = | |
| 80 | -* Fixed: GenerateBlocks dynamic tags in heading links keep working when SimpleTOC adds heading IDs. | |
| 81 | -* Fixed: GenerateBlocks dynamic heading text is resolved consistently in the TOC and matching heading anchors. | |
| 82 | -* Maintenance: Added automated GitHub README generation from the WordPress.org `readme.txt`. | |
| 83 | - | |
| 84 | -= 7.0.4 = | |
| 85 | -* Fixed: GenerateBlocks dynamic tags in heading links keep working when SimpleTOC adds heading IDs. | |
| 86 | -* Fixed: GenerateBlocks dynamic heading text is resolved consistently in the TOC and matching heading anchors. | |
| 87 | - | |
| 88 | -= 7.0.3 = | |
| 89 | -* Fixed: Removed an invalid `aria-labelledby` reference from hidden TOC `<details>` markup and now rely on native `<summary>` labeling. | |
| 90 | - | |
| 91 | -= 7.0.2 = | |
| 92 | -* Fixed: Removed an invalid `aria-labelledby` reference from hidden TOC `<details>` markup and now rely on native `<summary>` labeling. | |
| 93 | - | |
| 94 | -= 7.0.1 = | |
| 95 | -* Added: Direct link from the Advanced Features sidebar to the global SimpleTOC settings. | |
| 96 | -* Fixed: Global settings link now appears reliably in the editor sidebar. | |
| 97 | -* Changed: Wrapper toggle now reflects the automatic wrapper state while box style is active. | |
| 98 | - | |
| 99 | -= 7.0.0 = | |
| 100 | -* Added: Box style option in the block sidebar with a color picker and default gray background. | |
| 101 | -* Added: Global setting to force the default gray box style for all SimpleTOC blocks. | |
| 102 | -* Added: Frontend box-style CSS registered through block metadata. | |
| 103 | - | |
| 104 | -= 6.9.8 = | |
| 105 | -* Updated: Dependencies and house-keeping. | |
| 106 | -* Fix: corrected dependency declarations. | |
| 107 | - | |
| 108 | -= 6.9.7 = | |
| 109 | -* Fixed: GeneratePress Dynamic Tags work again - hopefully. If not, please report here https://github.com/mtoensing/simpletoc/issues/79#issuecomment-3745650464 Thanks @jhanten | |
| 110 | - | |
| 111 | -= 6.9.6 = | |
| 112 | -* Added: Coding standards cleanup with improved rules, cleaner code, safer output, and consistent naming. Thanks @ronalfy | |
| 113 | -* Added: Minimum PHP version requirement set to 7.3 | |
| 114 | - | |
| 115 | -= 6.9.4 = | |
| 116 | -* Added: Introduced proper PHP namespaces to avoid class and function name conflicts and improve overall code robustness. Thanks @ronalfy. | |
| 117 | -* Added: Improved sidebar sub-menu for the “Hide SimpleTOC” option | |
| 118 | - | |
| 119 | -= 6.9.3 = | |
| 120 | -* Fix: Fix Multiple IDs in Table of Contents Thanks @ronalfy | |
| 121 | -* Added: Support for GenerateBlocks 2.1.0 Thanks @ronalfy | |
| 122 | - | |
| 123 | -= 6.9.1 = | |
| 124 | -* Added: Support for the new V3 block api. | |
| 125 | -* Added: Tested compatibility with WordPress 6.9 | |
| 126 | - | |
| 127 | -= 6.7.3 = | |
| 128 | -* Added: Tested compatibility with WordPress 6.8 | |
| 129 | - | |
| 130 | -= 6.7.2 = | |
| 131 | -* Added: Support for GenerateBlocks 2.0. Thanks @blronaldhuereca | |
| 132 | -* Added: Included an accessibility statement in the plugin description. Thanks Gen Herres. | |
| 133 | - | |
| 134 | 86 | == Installation == |
| 135 | 87 | |
| 136 | 88 | 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... |
| 137 | 89 | |
| @@ -142,11 +94,11 @@ | ||
| 142 | 94 | = Configuring Global Settings in SimpleTOC = |
| 143 | 95 | |
| 144 | 96 | 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. |
| 145 | 97 | |
| 146 | -= How do I add a background color to SimpleTOC using Gutenberg groups? = | |
| 98 | += How do I add colors or the Box style to SimpleTOC? = | |
| 147 | 99 | |
| 148 | -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. | |
| 100 | +Select the SimpleTOC block and open Gutenberg's Styles tab. Choose the Box style or use the native color controls to set text, link, and background colors. Native spacing controls are available for vertical margins and padding. | |
| 149 | 101 | |
| 150 | 102 | = How to exclude a single heading from the TOC? = |
| 151 | 103 | |
| 152 | 104 | 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? |
| @@ -154,12 +106,54 @@ | ||
| 154 | 106 | = I would like to save my SimpleTOC settings as default. Is that possible? = |
| 155 | 107 | |
| 156 | 108 | 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. |
| 157 | 109 | |
| 158 | -= How to add a div tag wrapper to the TOC? = | |
| 110 | += How can I style SimpleTOC through theme.json? = | |
| 159 | 111 | |
| 160 | -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. | |
| 112 | +Add styles for the `simpletoc/toc` block to your theme.json. SimpleTOC uses the standard Gutenberg block wrapper and supports native colors, vertical margins, padding, font size, and line height settings. | |
| 161 | 113 | |
| 114 | +The following example sets default colors, spacing, and typography for every SimpleTOC block: | |
| 115 | + | |
| 116 | + { | |
| 117 | + "$schema": "https://schemas.wp.org/trunk/theme.json", | |
| 118 | + "version": 3, | |
| 119 | + "styles": { | |
| 120 | + "blocks": { | |
| 121 | + "simpletoc/toc": { | |
| 122 | + "color": { | |
| 123 | + "background": "#f5f5f5", | |
| 124 | + "text": "#1e1e1e" | |
| 125 | + }, | |
| 126 | + "elements": { | |
| 127 | + "link": { | |
| 128 | + "color": { | |
| 129 | + "text": "#0057b8" | |
| 130 | + } | |
| 131 | + } | |
| 132 | + }, | |
| 133 | + "spacing": { | |
| 134 | + "margin": { | |
| 135 | + "top": "1.5rem", | |
| 136 | + "bottom": "1.5rem" | |
| 137 | + }, | |
| 138 | + "padding": { | |
| 139 | + "top": "1rem", | |
| 140 | + "right": "1rem", | |
| 141 | + "bottom": "1rem", | |
| 142 | + "left": "1rem" | |
| 143 | + } | |
| 144 | + }, | |
| 145 | + "typography": { | |
| 146 | + "fontSize": "1rem", | |
| 147 | + "lineHeight": "1.6" | |
| 148 | + } | |
| 149 | + } | |
| 150 | + } | |
| 151 | + } | |
| 152 | + } | |
| 153 | + | |
| 154 | +Replace the example values with your theme's values or preset variables. Selecting the Box style adds the standard `is-style-boxed` class. | |
| 155 | + | |
| 162 | 156 | = How to allow developers to exclude specific headings programmatically? = |
| 163 | 157 | |
| 164 | 158 | Use the 'simpletoc_excluded_blocks' filter. For example, this code will exclude heading blocks that are inside a column block. |
| 165 | 159 | |
| @@ -196,10 +190,8 @@ | ||
| 196 | 190 | 8. SimpleTOC hidden in the accordion menu. |
| 197 | 191 | 9. SimpleTOC global settings. |
| 198 | 192 | |
| 199 | 193 | == Credits == |
| 200 | - | |
| 201 | -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) | |
| 202 | 194 | |
| 203 | 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 |
| 204 | 196 | |
| 205 | 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! |