webuni/commonmark-attributes-extension
最新稳定版本:1.0.0
Composer 安装命令:
composer require webuni/commonmark-attributes-extension
包简介
The attributes extension adds a syntax to define attributes on the various HTML elements in CommonMark PHP implementation.
README 文档
README
The Attributes extension adds a syntax to define attributes on the various HTML elements in markdown’s output.
DEPRECATED
This extension has been deprecated. All of its functionality now exists in league/commonmark 1.5+ under the League\CommonMark\Extension\Attributes namespace, so you should upgrade to that version and use that bundled extension instead of this one.
Installation
This project can be installed via Composer:
composer require webuni/commonmark-attributes-extension
Usage
use League\CommonMark\Converter; use League\CommonMark\DocParser; use League\CommonMark\Environment; use League\CommonMark\HtmlRenderer; use Webuni\CommonMark\AttributesExtension\AttributesExtension; $environment = Environment::createCommonMarkEnvironment(); $environment->addExtension(new AttributesExtension()); $converter = new Converter(new DocParser($environment), new HtmlRenderer($environment)); echo $converter->convertToHtml('# Hello World!');
Syntax
The basic syntax was inspired by Kramdown‘s Attribute Lists feature.
You can assign any attribute to a block-level element. Just directly prepend or follow the block with a block inline attribute list. That consists of a left curly brace, optionally followed by a colon, the attribute definitions and a right curly brace:
> A nice blockquote {: title="Blockquote title"} {#id .class} ## Header
As with a block-level element you can assign any attribute to a span-level elements using a span inline attribute list, that has the same syntax and must immediately follow the span-level element:
This is *red*{style="color: red"}.
统计信息
- 总下载量: 152.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 33
- 点击次数: 1
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-10