项目作者: cipemotion

项目描述 :
A League CommonMark extension.
高级语言: PHP
项目地址: git://github.com/cipemotion/commonmark.git
创建时间: 2016-02-29T16:56:32Z
项目社区:https://github.com/cipemotion/commonmark

开源协议:MIT License

下载


CipeMotion CommonMark extension

Inline converter

The inline syntax is meant for using quick markup in text settings like comments where it doesn’t make sense to have a full wysiwig editor but you do want to provide some formatting options to the user using markdown syntax.

Supports the following inline syntax:

  • _emphasis_ to <em>emphasis</em>
  • *bold* to <strong>bold</strong>
  • ~deleted~ to <del>deleted</del>
  • `code` to <code>code</code>
  • [link](https://url) to <a href="https://url">link</a>
  • ![link](https://url) to !<a href="https://url">link</a> (images are disabled)
  • newlines to paragraphs
  • stripping of html (can be disabled to allow HTML)

Usage

  1. // When `$allowHtml` is `true` HTML is _not_ removed in the output, default is false
  2. $converter = \CipeMotion\CommonMark\Markdown::getInlineConverter($allowHtml);
  3. $html = $converter->convertToHtml('This is _awesome_!')->getContent();
  4. // or
  5. $html = (string)$converter->convertToHtml('This is _awesome_!');