diff --git a/plugins/page-toc/CHANGELOG.md b/plugins/page-toc/CHANGELOG.md
new file mode 100644
index 0000000..8043746
--- /dev/null
+++ b/plugins/page-toc/CHANGELOG.md
@@ -0,0 +1,93 @@
+# v3.2.0
+## 02/23/2022
+
+1. [](#new)
+ * Support for HTML or Shortcode based headers with custom `id` attributes to specify an anchor
+ * Added German translation
+
+# v3.1.3
+## 01/03/2022
+
+1. [](#new)
+ * Require Grav `v1.7.26` to make use of built in `Plugin::inheritedConfigOption()`
+ * NOTE: `page-toc v3.1.2` was released prior to `Grav v1.7.26` and has been removed
+2. [](#improved)
+ * Don't force inclusion of `` or `
` tags to reduce chance of invalid HTML
+ * Improved `README.md`
+
+# v3.1.1
+## 12/16/2021
+
+1. [](#bugfix)
+ * Fixed some blueprint errors that caused errors on save
+ * Force `start` and `depth` to be integers [#17](https://github.com/trilbymedia/grav-plugin-page-toc/issues/17)
+
+# v3.1.0
+## 12/09/2021
+
+1. [](#new)
+ * **NEW** Added option to automatically copying to clipboard an anchor URL when clicking on it
+
+# v3.0.0
+## 12/03/2021
+
+1. [](#new)
+ * **NEW** Support built-in `anchors` with customization of icon/classes/css etc.
+ * **NEW** `[anchor]` shortcode for creating manual anchors for easy linking to page content
+ * Moved the vendor-based TOC functionality in-plugin to provide more flexibility and additional features
+ * Added several more Twig functions for increased flexibility
+ * Ability to limit the length of a fragment link
+ * Ability to set a custom prefix for anchor links
+ * Added `languages.yaml` file for text translations
+2. [](#improved)
+ * Independent control over the levels of anchors that should be built and the TOC displayed
+ * `page-toc:` page-level configuration can be set in parent pages and trickles down to child pages
+ * Removed dependency on HTML5 library and use the faster PHP `DOMDocument` class
+ * Translated text for the "Table of Contents" in the `page-toc.html.twig` template
+
+# v2.0.0
+## 11/24/2021
+
+1. [](#new)
+ * Added new `components/page-toc.html.twig` that can be extended and the HTML output modified
+ * Updated core TOC library to latest `3.0.2` version
+ * Requires PHP `7.3.6`
+ * Requires Grav `1.7+`
+ * Added Shortcode-like in-page syntax support. e.g. `[toc]`
+
+# v1.1.2
+## 06/01/2021
+
+1. [](#new)
+ * Added page-toc blueprints under "Advanced" tab for admin
+1. [](#improved)
+ * Updated to latest `knplabs/knp-menu` library
+1. [](#bugfix)
+ * Added `|raw` filter to twig output in README.md
+
+# v1.1.1
+## 12/02/2020
+
+1. [](#improved)
+ * Updated to latest `masterminds/html5` and `knplabs/knp-menu` libraries
+
+# v1.1.0
+## 04/01/2019
+
+1. [](#improved)
+ * Updated to latest `caseyamcl/toc` library
+1. [](#bugfix)
+ * Fixes relative levels [#6](https://github.com/trilbymedia/grav-plugin-page-toc/pull/9)
+ * Fixes incorrect reference to `end` when it should be `depth` [#7](https://github.com/trilbymedia/grav-plugin-page-toc/pull/7)
+
+# v1.0.1
+## 03/19/2017
+
+1. [](#improved)
+ * Fixed issue with `end` not being valid, should be `depth`. Updated README
+
+# v1.0.0
+## 08/01/2017
+
+1. [](#new)
+ * ChangeLog started...
diff --git a/plugins/page-toc/LICENSE b/plugins/page-toc/LICENSE
new file mode 100644
index 0000000..5234b4e
--- /dev/null
+++ b/plugins/page-toc/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2017 Team Grav
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/plugins/page-toc/README.md b/plugins/page-toc/README.md
new file mode 100644
index 0000000..0959c6c
--- /dev/null
+++ b/plugins/page-toc/README.md
@@ -0,0 +1,226 @@
+# Page Toc Plugin (Anchors + Table of Contents)
+
+The **Page Toc** Plugin is for [Grav CMS](http://github.com/getgrav/grav) that generates anchors based on HTML header tags, and can also create a table of contents from those headers.
+
+With version `3.0` this plugin is able to automatically generate anchor links with hover-click capability without the need for other plugins (such as the `anchors` plugin). This functionality operates independently from the now optional "table of contents" functionality.
+
+![](assets/page-toc.png)
+
+## Installation
+
+Installing the Page Toc plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
+
+### GPM Installation (Preferred)
+
+The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type:
+
+ bin/gpm install page-toc
+
+This will install the Page Toc plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/page-toc`.
+
+### Manual Installation
+
+To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `page-toc`. You can find these files on [GitHub](https://github.com/team-grav/grav-plugin-page-toc) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
+
+You should now have all the plugin files under
+
+ /your/site/grav/user/plugins/page-toc
+
+## Configuration
+
+Before configuring this plugin, you should copy the `user/plugins/page-toc/page-toc.yaml` to `user/config/plugins/page-toc.yaml` and only edit that copy.
+
+Here is the default configuration and an explanation of available options:
+
+```yaml
+enabled: true # Plugin enabled
+include_css: true # Include CSS
+active: true # Anchor IDs processed and generated for all pages
+start: 1 # Start header tag level (1 = h1) for TOC
+depth: 6 # Depth from start (2 = 2 levels deep) for TOC
+hclass: # Custom Header TOC styling classes
+anchors: # Anchor configuration
+ start: 1 # Start header tag level (1 = h1)
+ depth: 6 # Depth from start (2 = 2 levels deep)
+ link: true # Enabled auto-generation of clickable link with fragment
+ aria: Anchor # Aria label to use
+ class: # Custom Header anchor styling classes
+ icon: '#' # Icon to use, can be a symbol, emoji, ascii etc.
+ position: after # Position to put the anchor, `before|after`
+ copy_to_clipboard: true # Copy to clipboard functionality (coming soon)
+ slug_maxlen: 25 # Max length of slugs used for anchors
+ slug_prefix: # A prefix used in front of generated slugs
+```
+
+> You can now have `page-toc` automatically add anchors without there being a table of contents being used, just ensure `active` to `true`.
+
+By default, The plugin is `active` and will add header id attributes anchors for each header level found in a page. You can set `active: false` and then activate on a page basis by adding this to the page frontmatter:
+
+```yaml
+page-toc:
+ active: true
+```
+
+You can also configure which header tags to start and depth on when building the id attribute anchors by changing the `start` and `depth` values. This can also be done on a per-page basis.
+
+For example if you had a start of `3` and a depth of `3` you would get a TOC for `h3`, `h4`, and `h5`.
+
+## Usage
+
+### Shortcode-like syntax in your content
+
+You can use the following shortcode-like syntax in your content:
+
+```md
+[TOC] or [TOC/] or [toc] or [toc /]
+```
+
+This will replace the shortcode syntax with the Table of Contents with the `components/page-toc.html.twig` Twig template. Either the default one included in the `page-toc` plugin or an overridden version from your theme.
+
+For example in Quark theme, you will need to create a folder called `components/` under `templates/` so the file will be copied to:
+
+```shell
+user/themes/quark/templates/components/page-toc.html.twig
+```
+
+NOTE: It's not required to set the TOC plugin `active` if you use the shortcode syntax in your content. That is a good enough indication that you want the plugin to be active.
+
+### Anchor Shortcode
+
+Page TOC now includes a `anchor` shortcode that allows you to manually add linkable fragments in your content.
+The shortcode will automatically generate the link if no options are provided. Alternatively you can use the bbode syntax of `anchor="some-custom-id"` or you can explicity set it. You can also set a `prefix` and let the shortcode autogenerate the rest.
+
+For example:
+
+```markdown
+
+Ut sed nisl suscipit metus sollicitudin [anchor]
+ {% set table_of_contents = toc(page.content) %}
+ {% if table_of_contents is not empty %}
+
{{ 'PLUGIN_PAGE_TOC.TABLE_OF_CONTENTS'|t }}
+ {{ table_of_contents|raw }}
+ {% endif %}
+
+{% endif %}
+```
+
+The `toc_ordered()` Twig function does the same things as a the `toc()` function, except it uses an ordered list instead of an unordered one.
+
+or via the `toc_items()` function which rather than returning HTML directly returns objects and you can manipulate the output as needed:
+
+```twig
+{% macro toc_loop(items) %}
+ {% import _self as self %}
+ {% for item in items %}
+ {% set class = loop.first ? 'first' : loop.last ? 'last' : null %}
+
+ {% set table_of_contents = toc_items(page.content) %}
+ {% if table_of_contents is not empty %}
+
Table of Contents
+
+ {{ _self.toc_loop(table_of_contents.children) }}
+
+ {% endif %}
+
+{% endif %}
+```
+
+To explictly build a table of contents for a block of content:
+
+```markdown
+{% block my_content %}
+# Header 1
+
+## Header 1.1
+
+Nullam tempor quis lorem venenatis finibus. Maecenas ut condimentum nibh. Ut sed nisl suscipit metus sollicitudin ornare nec vitae nulla. Integer sed tortor eu ligula interdum rhoncus. Sed pulvinar ut massa et ullamcorper. Curabitur bibendum ante orci, nec porttitor dolor suscipit quis. Nulla et eros enim.
+
+### Header 1.1.1
+
+Integer sed tortor eu ligula interdum rhoncus.
+
+## Header 1.2
+{% endblock %}
+
+#### Table O' Contents
+{{ toc(block('my_content'), 2, 1) }}
+```
+
+The `add_anchors()` twig funtion can take a string or a block of content and automatically adds anchors to any headers found per the configuration for the page, but you can override the start and depth. For example here we have a Twig block but we just want to add anchors to the H2 tags:
+
+```markdown
+{% block my_content %}
+# Header 1
+
+## Header 1.1
+
+Nullam tempor quis lorem venenatis finibus. Maecenas ut condimentum nibh. Ut sed nisl suscipit metus sollicitudin ornare nec vitae nulla. Integer sed tortor eu ligula interdum rhoncus. Sed pulvinar ut massa et ullamcorper. Curabitur bibendum ante orci, nec porttitor dolor suscipit quis. Nulla et eros enim.
+
+### Header 1.1.1
+
+Integer sed tortor eu ligula interdum rhoncus.
+
+## Header 1.2
+{% endblock %}
+
+#### Anchors Away!
+{{ add_anchors(block('my_content'), 2, 1) }}
+```
+
+### Limiting levels in output
+
+As well as limiting the levels that the page TOC plugin will use in the table of contents, you can also limit the levels that are actually displayed. To do this you can pass an optional `start`, and `depth` value to the `toc()`, `toc_ordered()` , `toc_items()` and `add_anchors()` Twig functions:
+
+```twig
+{% set table_of_contents = toc(page.content, 3, 3) %}
+```
+
+This will only display `H3` , and **3** levels deeper (up to `H5`) in the TOC output.
+
+## Credits
+
+The majority of this plugin's functionality is provided by the [PHP TOC Generator](https://github.com/caseyamcl/toc) library by [Casey McLaughlin](https://github.com/caseyamcl). So Thanks for making this plugin for Grav possible!
+
+
diff --git a/plugins/page-toc/assets/page-toc-anchors.css b/plugins/page-toc/assets/page-toc-anchors.css
new file mode 100644
index 0000000..84c66dc
--- /dev/null
+++ b/plugins/page-toc/assets/page-toc-anchors.css
@@ -0,0 +1,22 @@
+.toc-anchor {
+ transition: hover 0.5s ease;
+ position: absolute;
+ opacity: 0;
+}
+
+.toc-anchor.after {
+ margin-left: 5px;
+}
+
+.toc-anchor.before {
+ margin-left: -22px;
+ padding-right: 8px;
+}
+
+.toc-anchor:after {
+ content: attr(data-anchor-icon);
+}
+
+:hover > .toc-anchor, .toc-anchor:focus {
+ opacity: .5;
+}
\ No newline at end of file
diff --git a/plugins/page-toc/assets/page-toc-anchors.js b/plugins/page-toc/assets/page-toc-anchors.js
new file mode 100644
index 0000000..ec5c459
--- /dev/null
+++ b/plugins/page-toc/assets/page-toc-anchors.js
@@ -0,0 +1,10 @@
+document.body.addEventListener('click', (event) => {
+ if (typeof event.target.dataset.anchorIcon !== 'undefined') {
+ const href = event.target.href;
+ navigator.clipboard.writeText(href)
+ .then(() => {})
+ .catch((error) => {
+ console.error('Unable to copy to clipboard the anchor', error);
+ });
+ }
+}, true);
\ No newline at end of file
diff --git a/plugins/page-toc/assets/page-toc.png b/plugins/page-toc/assets/page-toc.png
new file mode 100644
index 0000000..5140719
Binary files /dev/null and b/plugins/page-toc/assets/page-toc.png differ
diff --git a/plugins/page-toc/blueprints.yaml b/plugins/page-toc/blueprints.yaml
new file mode 100644
index 0000000..38ae211
--- /dev/null
+++ b/plugins/page-toc/blueprints.yaml
@@ -0,0 +1,170 @@
+name: Page Toc
+type: plugin
+slug: page-toc
+version: 3.2.0
+description: Generate a table of contents and anchors from a page
+icon: list
+author:
+ name: Trilby Media, LLC
+ email: hello@trilby.media
+ url: http://trilby.media
+homepage: http://trilby.media
+keywords: grav, plugin, toc, anchors
+bugs: https://github.com/trilbymedia/grav-plugin-page-toc/issues
+docs: https://github.com/trilbymedia/grav-plugin-page-toc/blob/develop/README.md
+license: MIT
+
+dependencies:
+ - { name: grav, version: '>=1.7.26' }
+
+form:
+ validation: strict
+ fields:
+ enabled:
+ type: toggle
+ label: PLUGIN_ADMIN.PLUGIN_STATUS
+ highlight: 1
+ default: 1
+ options:
+ 1: PLUGIN_ADMIN.ENABLED
+ 0: PLUGIN_ADMIN.DISABLED
+ validate:
+ type: bool
+ include_css:
+ type: toggle
+ label: PLUGIN_PAGE_TOC.INCLUDE_CSS
+ highlight: 1
+ default: 1
+ options:
+ 1: PLUGIN_ADMIN.ENABLED
+ 0: PLUGIN_ADMIN.DISABLED
+ validate:
+ type: bool
+ active:
+ type: toggle
+ label: PLUGIN_PAGE_TOC.ACTIVE_BY_DEFAULT
+ highlight: 1
+ default: 1
+ options:
+ 1: PLUGIN_ADMIN.ENABLED
+ 0: PLUGIN_ADMIN.DISABLED
+ validate:
+ type: bool
+
+ toc_section:
+ type: section
+ title: PLUGIN_PAGE_TOC.TOC_SECTION
+ underline: true
+
+ fields:
+ start:
+ type: select
+ label: PLUGIN_PAGE_TOC.START_TOC_HEADERS
+ help: PLUGIN_PAGE_TOC.START_TOC_HEADERS_HELP
+ size: x-small
+ classes: fancy
+ options:
+ 1: H1
+ 2: H2
+ 3: H3
+ 4: H4
+ 5: H5
+ 6: H6
+ validate:
+ type: number
+ depth:
+ type: range
+ label: PLUGIN_PAGE_TOC.DEPTH_TOC_HEADERS
+ help: PLUGIN_PAGE_TOC.DEPTH_TOC_HEADERS_HELP
+ classes: fancy
+ validate:
+ min: 1
+ max: 6
+ hclass:
+ type: text
+ label: PLUGIN_PAGE_TOC.HEADER_CSS_CLASSES
+ help: PLUGIN_PAGE_TOC.HEADER_CSS_CLASSES_HELP
+
+ anchors_section:
+ type: section
+ title: PLUGIN_PAGE_TOC.ANCHORS_SECTION
+ underline: true
+
+ fields:
+ anchors.start:
+ type: select
+ label: PLUGIN_PAGE_TOC.START_ANCHOR_HEADERS
+ size: x-small
+ classes: fancy
+ options:
+ 1: H1
+ 2: H2
+ 3: H3
+ 4: H4
+ 5: H5
+ 6: H6
+ validate:
+ type: number
+ anchors.depth:
+ type: range
+ label: PLUGIN_PAGE_TOC.DEPTH_ANCHOR_HEADERS
+ help: PLUGIN_PAGE_TOC.DEPTH_ANCHOR_HEADERS_HELP
+ classes: fancy
+ validate:
+ min: 1
+ max: 6
+ anchors.link:
+ type: toggle
+ label: PLUGIN_PAGE_TOC.LINK_ANCHOR_HEADERS
+ highlight: 1
+ default: 1
+ options:
+ 1: Enabled
+ 0: Disabled
+ validate:
+ type: bool
+ anchors.aria:
+ type: text
+ label: PLUGIN_PAGE_TOC.ARIA_LABEL
+ default: Anchor
+ anchors.class:
+ type: text
+ label: PLUGIN_PAGE_TOC.ANCHORS_CLASS
+ help: PLUGIN_PAGE_TOC.ANCHORS_CLASS_HELP
+ anchors.icon:
+ type: text
+ label: PLUGIN_PAGE_TOC.ANCHORS_ICON
+ help: PLUGIN_PAGE_TOC.ANCHORS_ICON_HELP
+ default: '#'
+ size: x-small
+ anchors.position:
+ type: select
+ label: PLUGIN_PAGE_TOC.ANCHORS_POSITION
+ help: PLUGIN_PAGE_TOC.ANCHORS_POSITION_HELP
+ size: small
+ default: after
+ options:
+ before: PLUGIN_PAGE_TOC.BEFORE_TEXT
+ after: PLUGIN_PAGE_TOC.AFTER_TEXT
+ anchors.copy_to_clipboard:
+ type: toggle
+ label: PLUGIN_PAGE_TOC.COPY_TO_CLIPBOARD
+ help: PLUGIN_PAGE_TOC.COPY_TO_CLIPBOARD_HELP
+ highlight: 1
+ default: 1
+ options:
+ 1: Enabled
+ 0: Disabled
+ validate:
+ type: bool
+ anchors.slug_maxlen:
+ type: number
+ label: PLUGIN_PAGE_TOC.SLUG_MAXLEN
+ help: PLUGIN_PAGE_TOC.SLUG_MAXLEN_HELP
+ size: x-small
+ default: 25
+ append: 'chars'
+ anchors.slug_prefix:
+ type: text
+ label: PLUGIN_PAGE_TOC.SLUG_PREFIX
+ help: PLUGIN_PAGE_TOC.SLUG_PREFIX_HELP
diff --git a/plugins/page-toc/blueprints/page-toc.yaml b/plugins/page-toc/blueprints/page-toc.yaml
new file mode 100644
index 0000000..de6998f
--- /dev/null
+++ b/plugins/page-toc/blueprints/page-toc.yaml
@@ -0,0 +1,142 @@
+form:
+ fields:
+ tabs:
+ fields:
+ advanced:
+ type: tab
+
+ fields:
+ header.page-toc-section:
+ type: section
+ title: Page Table-of-Contents
+ underline: true
+
+ fields:
+ header.page-toc.active:
+ toggleable: true
+ type: toggle
+ label: PLUGIN_PAGE_TOC.ACTIVE_BY_DEFAULT_PAGE
+ help: PLUGIN_PAGE_TOC.ACTIVE_BY_DEFAULT_PAGE_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'active']
+ options:
+ 1: PLUGIN_ADMIN.YES
+ 0: PLUGIN_ADMIN.NO
+ validate:
+ type: bool
+
+ header.page-toc.start:
+ toggleable: true
+ type: select
+ size: x-small
+ label: PLUGIN_PAGE_TOC.START_TOC_HEADERS
+ help: PLUGIN_PAGE_TOC.START_TOC_HEADERS_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'start']
+ options:
+ 1: H1
+ 2: H2
+ 3: H3
+ 4: H4
+ 5: H5
+ 6: H6
+ validate:
+ type: number
+ header.page-toc.depth:
+ toggleable: true
+ type: range
+ label: PLUGIN_PAGE_TOC.DEPTH_TOC_HEADERS
+ help: PLUGIN_PAGE_TOC.DEPTH_TOC_HEADERS_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'depth']
+ validate:
+ min: 1
+ max: 6
+ header.page-toc.hclass:
+ toggleable: true
+ type: text
+ label: PLUGIN_PAGE_TOC.HEADER_CSS_CLASSES
+ help: PLUGIN_PAGE_TOC.HEADER_CSS_CLASSES_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'hclass']
+
+ header.page-toc-anchors-section:
+ type: section
+ title: PLUGIN_PAGE_TOC.PAGE_ANCHORS_SECTION
+ underline: true
+
+ fields:
+ header.page-toc.anchors.start:
+ toggleable: true
+ type: select
+ label: PLUGIN_PAGE_TOC.START_ANCHOR_HEADERS
+ size: x-small
+ classes: fancy
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.start']
+ options:
+ 1: H1
+ 2: H2
+ 3: H3
+ 4: H4
+ 5: H5
+ 6: H6
+ validate:
+ type: number
+ header.page-toc.anchors.depth:
+ toggleable: true
+ type: range
+ label: PLUGIN_PAGE_TOC.DEPTH_ANCHOR_HEADERS
+ classes: fancy
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.depth']
+ validate:
+ min: 1
+ max: 6
+ header.page-toc.anchors.link:
+ toggleable: true
+ type: toggle
+ label: PLUGIN_PAGE_TOC.LINK_ANCHOR_HEADERS
+ highlight: 1
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.link']
+ options:
+ 1: Enabled
+ 0: Disabled
+ validate:
+ type: bool
+ header.page-toc.anchors.aria:
+ toggleable: true
+ type: text
+ label: PLUGIN_PAGE_TOC.ARIA_LABEL
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.aria']
+ header.page-toc.anchors.class:
+ toggleable: true
+ type: text
+ label: PLUGIN_PAGE_TOC.ANCHORS_CLASS
+ help: PLUGIN_PAGE_TOC.ANCHORS_CLASS_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.class']
+ header.page-toc.anchors.icon:
+ toggleable: true
+ type: text
+ label: PLUGIN_PAGE_TOC.ANCHORS_ICON
+ help: PLUGIN_PAGE_TOC.ANCHORS_ICON_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.icon']
+ size: x-small
+ header.page-toc.anchors.position:
+ toggleable: true
+ type: select
+ label: PLUGIN_PAGE_TOC.ANCHORS_POSITION
+ help: PLUGIN_PAGE_TOC.ANCHORS_POSITION_HELP
+ size: small
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.position']
+ options:
+ before: PLUGIN_PAGE_TOC.BEFORE_TEXT
+ after: PLUGIN_PAGE_TOC.AFTER_TEXT
+ header.page-toc.anchors.slug_maxlen:
+ toggleable: true
+ type: number
+ label: PLUGIN_PAGE_TOC.SLUG_MAXLEN
+ help: PLUGIN_PAGE_TOC.SLUG_MAXLEN_HELP
+ size: x-small
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.slug_maxlen']
+ append: 'chars'
+ header.page-toc.anchors.slug_prefix:
+ toggleable: true
+ type: text
+ label: PLUGIN_PAGE_TOC.SLUG_PREFIX
+ help: PLUGIN_PAGE_TOC.SLUG_PREFIX_HELP
+ data-default@: ['\Grav\Plugin\PageTOCPlugin::configVar', 'anchors.slug_prefix']
\ No newline at end of file
diff --git a/plugins/page-toc/classes/HtmlHelper.php b/plugins/page-toc/classes/HtmlHelper.php
new file mode 100644
index 0000000..14b9b26
--- /dev/null
+++ b/plugins/page-toc/classes/HtmlHelper.php
@@ -0,0 +1,89 @@
+
+ *
+ * Licensed under MIT, see LICENSE.
+ */
+
+declare(strict_types=1);
+
+namespace Grav\Plugin\PageToc;
+
+use ArrayIterator;
+use DOMDocument;
+use DomElement;
+use DOMXPath;
+
+/**
+ * Trait that helps with HTML-related operations
+ *
+ * @package TOC
+ */
+trait HtmlHelper
+{
+ protected function getHTMLParser($markup)
+ {
+ libxml_use_internal_errors(true);
+ $domDocument = new \DOMDocument();
+ $domDocument->loadHTML(mb_convert_encoding("