stillat/statamic-bard-heading-permalinks 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stillat/statamic-bard-heading-permalinks

最新稳定版本:v1.1.0

Composer 安装命令:

composer require stillat/statamic-bard-heading-permalinks

包简介

README 文档

README

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:

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

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Stillat\StatamicBardHeadingPermalinks\HeadingPermalinkExtension;

class AppServiceProvider
{
    public function boot()
    {
        // Register all heading permalink extensions.
        HeadingPermalinkExtension::registerAll();
    }
}

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.

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:

php artisan vendor:publish --tag=bard-permalinks-config

A new file will be created at config/bard_permalinks.php, with the following contents:

<?php

use League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkRenderer;

return [
    'config' => [
        '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/.

License

Bard Heading Permalinks is free software, released under the MIT license.

统计信息

  • 总下载量: 514
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-11