| @@ -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 | 4 | Requires at least: 6.2 |
| 5 | -Tested up to: 7.0 | |
| 6 | -Stable tag: 7.2.0 | |
| 5 | +Tested up to: 7.1 | |
| 6 | +Stable tag: 7.3.1 | |
| 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,10 +41,11 @@ | ||
| 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 | 51 | * Standard Gutenberg block wrapper with navigation role and ARIA label attributes. |
| @@ -53,13 +54,14 @@ | ||
| 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 | |
| 65 | 67 | = Compatibility = |
| @@ -71,13 +73,19 @@ | ||
| 71 | 73 | |
| 72 | 74 | 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 | 75 | |
| 74 | 76 | == Changelog == |
| 75 | -= 7.2.0 = | |
| 76 | -* Changed: SimpleTOC now always uses the standard Gutenberg block wrapper so themes can style it through theme.json. | |
| 77 | -* Removed: Obsolete block and global wrapper settings because the standard wrapper is now always active. | |
| 78 | -* Added: Native Gutenberg typography controls for font size and line height. | |
| 77 | += 7.3.1 = | |
| 78 | +* Fixed: Heading anchors for non-Latin scripts (Japanese, Chinese, Korean, Cyrillic, etc.) were double URL-encoded, breaking externally shared or hand-written fragment links. Props to the reporter of issue #89. | |
| 79 | 79 | |
| 80 | += 7.3.0 = | |
| 81 | +* Changed: Box is now a native Gutenberg block style in the Styles tab. | |
| 82 | +* Added: Native text, link, background color, margin, and padding controls. | |
| 83 | +* Added: theme.json styling support for colors, spacing, and typography. | |
| 84 | +* Added: WordPress 7.1 support and automated compatibility tests. | |
| 85 | +* Changed: Existing box-style blocks and the global Force box style setting remain compatible. | |
| 86 | +* Thanks: Lovro Hrust (@lovor) for the theme.json and block styling feedback. | |
| 87 | + | |
| 80 | 88 | == Installation == |
| 81 | 89 | |
| 82 | 90 | 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... |
| 83 | 91 | |
| @@ -88,11 +96,11 @@ | ||
| 88 | 96 | = Configuring Global Settings in SimpleTOC = |
| 89 | 97 | |
| 90 | 98 | 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. |
| 91 | 99 | |
| 92 | -= How do I add a background color to SimpleTOC using Gutenberg groups? = | |
| 100 | += How do I add colors or the Box style to SimpleTOC? = | |
| 93 | 101 | |
| 94 | -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. | |
| 102 | +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. | |
| 95 | 103 | |
| 96 | 104 | = How to exclude a single heading from the TOC? = |
| 97 | 105 | |
| 98 | 106 | 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? |
| @@ -102,9 +110,51 @@ | ||
| 102 | 110 | 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. |
| 103 | 111 | |
| 104 | 112 | = How can I style SimpleTOC through theme.json? = |
| 105 | 113 | |
| 106 | -Add styles for the `simpletoc/toc` block to your theme.json. SimpleTOC uses the standard Gutenberg block wrapper and supports native font size and line height settings. | |
| 114 | +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. | |
| 115 | + | |
| 116 | +The following example sets default colors, spacing, and typography for every SimpleTOC block: | |
| 117 | + | |
| 118 | + { | |
| 119 | + "$schema": "https://schemas.wp.org/trunk/theme.json", | |
| 120 | + "version": 3, | |
| 121 | + "styles": { | |
| 122 | + "blocks": { | |
| 123 | + "simpletoc/toc": { | |
| 124 | + "color": { | |
| 125 | + "background": "#f5f5f5", | |
| 126 | + "text": "#1e1e1e" | |
| 127 | + }, | |
| 128 | + "elements": { | |
| 129 | + "link": { | |
| 130 | + "color": { | |
| 131 | + "text": "#0057b8" | |
| 132 | + } | |
| 133 | + } | |
| 134 | + }, | |
| 135 | + "spacing": { | |
| 136 | + "margin": { | |
| 137 | + "top": "1.5rem", | |
| 138 | + "bottom": "1.5rem" | |
| 139 | + }, | |
| 140 | + "padding": { | |
| 141 | + "top": "1rem", | |
| 142 | + "right": "1rem", | |
| 143 | + "bottom": "1rem", | |
| 144 | + "left": "1rem" | |
| 145 | + } | |
| 146 | + }, | |
| 147 | + "typography": { | |
| 148 | + "fontSize": "1rem", | |
| 149 | + "lineHeight": "1.6" | |
| 150 | + } | |
| 151 | + } | |
| 152 | + } | |
| 153 | + } | |
| 154 | + } | |
| 155 | + | |
| 156 | +Replace the example values with your theme's values or preset variables. Selecting the Box style adds the standard `is-style-boxed` class. | |
| 107 | 157 | |
| 108 | 158 | = How to allow developers to exclude specific headings programmatically? = |
| 109 | 159 | |
| 110 | 160 | Use the 'simpletoc_excluded_blocks' filter. For example, this code will exclude heading blocks that are inside a column block. |