定制 marquage/parsedownanchors 二次开发

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

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

marquage/parsedownanchors

Composer 安装命令:

composer require marquage/parsedownanchors

包简介

extends Parsedown-extra to automatically add id anchors with unique slugs

README 文档

README

Software License Quality Score

This tiny extension is part of the larger markdown-driven note-taking site. Although it is primarily aimed for building table of contents, this package accomplishes two things only:

  • It automatically generates id-anchors for headers (h1-h6), using Cocur/Slugify. It does not require writing down header slugs ahead of time.
  • It ensures that each id is unique. From the simple included test:
## The Site  
## The Site

will turn to:

<h2 id="the-site">The Site</h2>
<h2 id="the-site-1">The Site</h2>

For the larger project that relies on the excellent Tocbot, that's all that was needed but I could not find an extension that addressed these simple concerns. There are other packages for Parsedown TOC, such as these two.

Install

Via Composer

$ composer require marquage/parsedownanchors

Usage

In the unlikely case that you would only need this tiny package, you can call it instead of Parsedown since it is an extension and you would have access to all the rich features of Parsedown-extra.

$parser = new ParsedownSlugified();
$file = file_get_contents('[...]');
return $parser->parse($file);

Testing

$ composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固