定制 ptrofimov/inml 二次开发

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

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

ptrofimov/inml

Composer 安装命令:

composer require ptrofimov/inml

包简介

inML - inline markup language

README 文档

README

inML is concise and intuitive markup language. This repository contains description of inML markup language and PHP-written library and example script in order to render inML-formatted text into HTML and Text formats.

Basic inML -> HTML transformation rules

    1. Transforms paragraphs with style into HTML paragraphs with class:
.style            <p class="style">
Paragraph.   =>       Paragraph.
                  </p>
    1. Transforms lines with style into HTML spans with class:
.style Line        <span class="style">
OR            =>       Line
Line .style        </span>
    1. Transforms words with style into HTML spans with class:
                  <span class="style">
word.style   =>       word
                  </span>
    1. If parser finds styles equal HTML5 tags, it transforms them to corresponding tags (not classes):
.div.style        <div class="style">
Paragraph.   =>       Paragraph.
                  </div>
    1. You can define your own styles right in the document. Parser will automatically recognise type of style. For example, you can make a hyperlink by defining your own style with url:
inML.link is intuitive markup language.        
                                          =>   <a href="https://github.com/ptrofimov/inml">inML</a>
#link https://github.com/ptrofimov/inml            is intuitive markup language.

Example with screenshots

inML-formatted text:

.h1 inML - inline markup language

.i
inML.b is simple and compact markup
that could be easily transformed into HTML.b

.b Key points:

.ul
.li Easy text formatting
.li Traditional embedded HTML.b styles
.li Ability to add user styles

transforms into HTML:

<p>
    <h1>inML - inline markup language</h1>
</p>
<i>
    <b>inML</b> is simple and compact markup
        that could be easily transformed into <b>HTML</b>
</i>
<p>
    <b>Key points:</b>
</p>
<ul>
    <li>Easy text formatting</li>
    <li>Traditional embedded <b>HTML</b> styles</li>
    <li>Ability to add user styles</li>
</ul>

and looks like this (with predefined CSS styles):

Example inML to HTML transformation

Installation and usage

    1. Install composer if need.
    1. Create composer.json or add dependency:
{
   "require":{
       "ptrofimov/inml":"*"
   }
}
    1. Install package:
composer install
    1. Usage example:
use \Inml\Text;
use \Inml\Render\Html;

$html = (new Html)->render(new Text($inml));
    1. Enjoy!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2012-12-16