https://github.com/stillat/statamic-bard-heading-permalinks
Provides a permalink extension for Bard that is compatible with Statamic's markdown settings.
https://github.com/stillat/statamic-bard-heading-permalinks
Last synced: 12 months ago
JSON representation
Provides a permalink extension for Bard that is compatible with Statamic's markdown settings.
- Host: GitHub
- URL: https://github.com/stillat/statamic-bard-heading-permalinks
- Owner: Stillat
- License: mit
- Created: 2023-11-11T15:52:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-11T20:05:49.000Z (about 2 years ago)
- Last Synced: 2025-01-18T12:53:07.322Z (over 1 year ago)
- Language: PHP
- Size: 56.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Bard Heading Permalinks for Statamic
Bard Heading Permalinks is an addon for Statamic that can add permalinks automatically to headings, similar to how permalinks can be added to markdown content.
## How to Install
To install Bard Heading Permalinks run the following command from the root of your project:
``` bash
composer require stillat/statamic-bard-heading-permalinks
```
## How to Use
Once installed you will need to register the Bard extensions provided by this addon. This is typically done within your site's `AppServiceProvider`.
Bard Heading Permalinks provides two different extensions:
* `Permalink`: Responsible for rendering the embedded link within headings
* `HeadingPermalinkExtension`: Adds the permalink, and any other details to rendered headings
For convenience, both extensions may be registered at once:
```php
Note: The `HeadingPermalinkExtension` will replace any existing heading extension.
## Configuration
By default, Bard Heading Permalinks will utilize the `heading_permalink` settings for the *default* markdown parser. For more information on configuring Statamic's markdown parsers, consider reading the official documentation here: [https://statamic.dev/extending/markdown#configuration](https://statamic.dev/extending/markdown#configuration).
However, you may publish Bard Heading Permalink's configuration file to override any settings by running the following command from the root of your project:
```bash
php artisan vendor:publish --tag=bard-permalinks-config
```
A new file will be created at `config/bard_permalinks.php`, with the following contents:
```php
[
'html_class' => config('statamic.markdown.configs.default.heading_permalink.html_class', 'heading-permalink'),
'id_prefix' => config('statamic.markdown.configs.default.heading_permalink.id_prefix', 'content'),
'apply_id_to_heading' => config('statamic.markdown.configs.default.heading_permalink.apply_id_to_heading', false),
'heading_class' => config('statamic.markdown.configs.default.heading_permalink.heading_class', ''),
'fragment_prefix' => config('statamic.markdown.configs.default.heading_permalink.fragment_prefix', 'content'),
'insert' => config('statamic.markdown.configs.default.heading_permalink.insert', 'before'),
'min_heading_level' => config('statamic.markdown.configs.default.heading_permalink.min_heading_level', 1),
'max_heading_level' => config('statamic.markdown.configs.default.heading_permalink.max_heading_level', 6),
'title' => config('statamic.markdown.configs.default.heading_permalink.title', 'Permalink'),
'symbol' => config('statamic.markdown.configs.default.heading_permalink.symbol', HeadingPermalinkRenderer::DEFAULT_SYMBOL),
'aria_hidden' => config('statamic.markdown.configs.default.heading_permalink.aria_hidden', true),
],
];
```
Bard Heading Permalinks supports all documented configuration options provided by CommonMark's Heading Permalink Extension. For more information on each configuration option, please consult their documentation page here: [https://commonmark.thephpleague.com/2.4/extensions/heading-permalinks/](https://commonmark.thephpleague.com/2.4/extensions/heading-permalinks/).
## License
Bard Heading Permalinks is free software, released under the MIT license.