简介

CommonMark Query Language is a DSL for describing how to travel through a CommonMark Node tree implemented as a parser and compiler for a small set of instructions, and a virtual machine for executing those instructions.

Paths:

In it's most simplistic form, a CQL query combines the following paths and / to describe how to travel through a tree:

firstChild

lastChild

previous

next

parent

For example, /firstChild/lastChild would travel to the last child node of the first child node.

Loops

CQL can be instructed to loop, for example through the children of, or siblings to a particular node, by using the path children, or siblings. For example, /firstChild/children will travel to all the children of the first child node.

Subqueries

CQL can be instructed how to travel by using a subquery like [/firstChild]. For example, /firstChild/children[/firstChild] will travel to the first child node of all the children of the first child node.

Loop Constraints

While looping, CQL can be instructed to constrict the travelled path to nodes of particular type. For example /children(BlockQuote) will travel to the children of a node where the type is BlockQuote. The following types are recognized (case insensitively):

BlockQuote

List

Item

CodeBlock

HtmlBlock

CustomBlock

Paragraph

Heading

ThematicBreak

Text

SoftBreak

LineBreak

Code

HtmlInline

CustomInline

Emphasis

Strong

Link

Image

Types may be used as a union, for example /children(BlockQuote List) will travel to the children of a node where the type is BlockQuote or List. Types, or unions of types, may be also negated. For example /children(~BlockQuote) will travel to the children of a node where the type is not BlockQuote, and /children(~BlockQuote Paragraph) will travel to the children of a node where the type is not BlockQuote or Paragraph

Path Constraints

CQL can be instructed to create a loop to travel to a node of a particular type, at a particular path. For example, /firstChild(BlockQuote) will travel to the first child node where the type is BlockQuote. Note that like other loops for children and siblings, this kind of path can only be followed by a subquery.

Implementation Notes

While CQL has been implemented as part of the PHP CommonMark extension, it stands separately from PHP and does not use PHP's virtual machine or internal representation of values.

php里面的mark,PHP CommonMarkCQL 用法 手册 | 示例代码相关推荐

  1. php种loop用法,PHP EvLoop 用法 手册 | 示例代码

    EvLoop::backend - Returns an integer describing the backend used by libev EvLoop::check - Creates Ev ...

  2. 装饰器的定义、语法糖用法及示例代码

    1. 装饰器的定义 就是给已有函数增加额外功能的函数,它本质上就是一个闭包函数. 装饰器的功能特点: 不修改已有函数的源代码 不修改已有函数的调用方式 给已有函数增加额外的功能 2. 装饰器的示例代码 ...

  3. 小书匠 导出html,小书匠编辑器使用手册(示例代码)

    小书匠编辑器使用手册 小书匠 使用手册 概要 小书匠编辑器是一款专为markdown写作而设计的编辑器. 主要功能 专为markdown写作设计的文档编辑器,让用户心无旁骛的进行创作. 多种编辑模式. ...

  4. 百度 android geocoding,百度地图经纬度批量查找功能XGeocoding使用手册(示例代码)

    <XGeocoding使用手册> 1.下载XGeocoding V2 http://www.gpsspg.com/xgeocoding/download/ 2.解压XGeocoding_v ...

  5. android mysql代码_LitePal——Android数据库框架完整使用手册(示例代码)

    LitePal for Android LitePal是一个开源的Android库,使开发人员使用SQLite数据库非常简单.您无需编写任何SQL语句就可以完成大部分数据库操作,包括创建或升级表,增. ...

  6. linux里强制覆盖,Linux cp 强制覆盖(示例代码)

    简介 CentOS 中 cp -fr src dest,即使加了-f也是不能强行覆盖的,这时怎么回事的呢?一两个文件还好说,就输几个yes吧,但是要是n多文件怎么办,那还不输死人呢?下面提供三种解决办 ...

  7. PyTorch里面的torch.nn.Parameter()

    在刷官方Tutorial的时候发现了一个用法self.v = torch.nn.Parameter(torch.FloatTensor(hidden_size)),看了官方教程里面的解释也是云里雾里, ...

  8. JAVA里面的int类型 和Integer类型,有什么不一样

    JAVA里面的int类型 和Integer类型,有什么不一样 原创 2013年09月04日 23:15:11 标签: java / 2120 编辑 删除 JAVA里面的int类型 和Integer类型 ...

  9. thinkphp url去掉index.php,thinkphp 去掉URL 里面的index.php(?s=)

    例如你的原路径是 http://localhost/test/index.php/home/goods/index.html 那么现在的地址是 http://localhost/test/home/g ...

最新文章

  1. 设置VSCode隐藏菜单栏快捷键Alt+T(头部)、隐藏状态栏快捷键Alt+B(底部),为单屏开发者腾出更多编码空间
  2. C++中rdbuf()简介及文件流的概念
  3. threejs 纹理流动_Threejs多重纹理与过程纹理实现
  4. Disruptor 线程间共享数据无需竞争
  5. Gentoo 安装日记 16(编译内核)
  6. Linux浏览文件的常用命令
  7. python多线程读取数据库数据_python多线程操作MySQL数据库pymysql
  8. PHP代码20个实用技巧(转)
  9. python barrier_Python线程障碍对象Barrier原理详解
  10. (亲测)vue-cli项目添加骨架屏多种方式,自动生成骨架屏
  11. 【STM32】手把手固件库开发工程建立
  12. 计算机网络class1(概念、组成、功能和分类)
  13. django 22、python3.4环境下新建django应用失败报错计算机中丢失python27.dll的解决方法
  14. python 接受前端文件并上传
  15. wps excel查找不定位_EXCEL几个常用函数,几个小案例,最后来个定位查找
  16. DQN_Continuous_Action
  17. 打印出一个数的每一位
  18. 10年网安经验分享:一般人别瞎入网络安全行业
  19. Python3.9数据库SQLite3学起(6)
  20. tps和tips区别_性能测试:TPS和QPS的区别

热门文章

  1. 在单元测试中访问私有字段
  2. Spring Integration Publisher
  3. 在OSGi中为Karaf构建Camel-CXF REST服务–组播和聚合
  4. Java Web托管选项流程图
  5. 计算机数据链路层教案,第三章 数据链路层(2) 新.ppt
  6. java文件复制速度_【Java】Java代码拷贝文件的速度
  7. QT 手动创建信号函数 与 槽函数
  8. java imageview的使用_Android使用控件ImageView加载图片的方法
  9. iptables 开放远程_JavaWeb项目的部署以及远程调试
  10. mysql+after+commit_Spring事务aftercommit原理及实践