定制 cable8mm/toc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cable8mm/toc

最新稳定版本:v1.3.0

Composer 安装命令:

composer require cable8mm/toc

包简介

The TOC is an opinionated table of contents generator.

README 文档

README

code-style run-tests Packagist Version Packagist Downloads Packagist Dependency Version Packagist Stars Packagist License

The TOC is a library for the project document2.

Features

  • Laravel toc
  • Samsung Tizen toc
  • Naver clova ai toc
  • Rhymix toc

Installation

composer require cable8mm/toc

Usage

namespace Cable8mm\Toc;

$markdown = '
- ## Prologue
    - [Release Notes](/docs/{{version}}/releases)
    - [Upgrade Guide](/docs/{{version}}/upgrade)
    - [Contribution Guide](/docs/{{version}}/contributions)
- ## Getting Started
    - [Installation](/docs/{{version}}/installation)
    - [Configuration](/docs/{{version}}/configuration)
';

$lines = Toc::of($markdown)->getLines();

foreach ($lines as $line) {
    // example "- ## Prologue"
    // example "    - [Release Notes](/docs/{{version}}/releases)"
    print $line->getTitle().PHP_EOL;
    //=> "Prologue"
    //=> "Release Notes"
    print $line->getLink().PHP_EOL;
    //=> null
    //=> "/docs/{{version}}/releases"
    print $line->getType().PHP_EOL;
    //=> ItemEnum::section
    //=> ItemEnum::page
    print $line->getDepth().PHP_EOL;
    //=> 1
    //=> 2
}

Testing

composer test

Formatting

composer lint
# Modify all files to comply with the PSR-12.

composer inspect
# Inspect all files to ensure compliance with PSR-12.

License

The Document2 project is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-26