承接 tzlion/muyl 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tzlion/muyl

Composer 安装命令:

composer require tzlion/muyl

包简介

parser for MUYL text formatting markup language

README 文档

README

A parser for MUYL, a probably unnecessary markup language for text formatting which I invented to write my own blog posts. Converts MUYL to HTML.

The MUYL language itself and this parser are versioned separately, but since this parser is currently the only implementation and documentation of the language, at least the major and minor versions will probably match up.

Currently the language is at version 0.1.1.

Usage

Install it and include it in your project somehow. Use composer, or don't, I'm not the boss of you. It has no dependencies aside from PHPUnit for testing and all the code is in MarkupParser.php.

Then you can either...

$markedUpText = '::this text is marked up::';
$parser = new TzLion\Muyl\MarkupParser();
$html = $parser->toHtml($yourMarkedUpText);

Or

$yourMarkedUpText = '::this text is marked up::';
$html = TzLion\Muyl\MarkupParser::toHtmlStatic($markedUpText);

$markupSpecialChars is also exposed as a static variable on MarkupParser, this is an array containing all special characters used by MUYL if you need them for something.

Options

Both the MarkupParser constructor and the static method toHtmlStatic take four additional optional parameters, in order:

  • $allowHtml, default false.
    If true, arbitrary HTML from the input text will be preserved. If false, HTML special chars will be escaped before parsing.
  • $allowExternalLinks, default true.
    Enables or disables the external link syntax e.g. [http://example.com].
  • $allowImages, default true.
    Enables or disables the image embedding syntax e.g. {path/to/img.jpg}
  • $internalLinkCallback, default null.
    Used in conjunction with the internal link syntax e.g. [[some-page]]. A callback taking in some kind of identifier for a page within your app and outputting an array containing 2 elements, a URL and the link text. If not set, internal links will be disabled.

Syntax

Syntax can be found in syntax.txt

To do

  • Nested lists
  • Better config possibly allowing for any feature to be enabled/disabled

Irony

Yes I am aware of the irony of this readme file for a markup language parser being written in a different markup language to the language parsed by the parser thank you

Language version history

v0.1.1 - adds the ability to insert line breaks in list items

v0.1.0 - first public release

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固