@lezer/markdown
Advanced tools
Comparing version 0.15.4 to 0.15.5
@@ -0,1 +1,7 @@ | ||
## 0.15.5 (2022-02-18) | ||
### New features | ||
The `BlockContext` type now has a `depth` property providing the amount of parent nodes, and a `parentType` method allowing code to inspect the type of those nodes. | ||
## 0.15.4 (2022-02-02) | ||
@@ -2,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Tree, NodePropSource, TreeFragment, NodeSet, Input, Parser, PartialParse, ParseWrapper } from "@lezer/common"; | ||
import { Tree, NodeType, NodePropSource, TreeFragment, NodeSet, Input, Parser, PartialParse, ParseWrapper } from "@lezer/common"; | ||
export declare enum Type { | ||
@@ -79,2 +79,4 @@ Document = 1, | ||
private reuseFragment; | ||
get depth(): number; | ||
parentType(depth?: number): NodeType; | ||
nextLine(): boolean; | ||
@@ -81,0 +83,0 @@ private moveRangeI; |
{ | ||
"name": "@lezer/markdown", | ||
"version": "0.15.4", | ||
"version": "0.15.5", | ||
"description": "Incremental Markdown parser that consumes and emits Lezer trees", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs", |
@@ -260,2 +260,11 @@ <!-- /README.md is generated from /src/README.md --> | ||
<dd><p>The parser configuration used.</p> | ||
</dd><dt id="user-content-blockcontext.depth"> | ||
<code><strong><a href="#user-content-blockcontext.depth">depth</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt> | ||
<dd><p>The number of parent blocks surrounding the current block.</p> | ||
</dd><dt id="user-content-blockcontext.parenttype"> | ||
<code><strong><a href="#user-content-blockcontext.parenttype">parentType</a></strong>(<a id="user-content-blockcontext.parenttype^depth" href="#user-content-blockcontext.parenttype^depth">depth</a>⁠?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a> = this.depth - 1) → <a href="https://lezer.codemirror.net/docs/ref/#common.NodeType">NodeType</a></code></dt> | ||
<dd><p>Get the type of the parent block at the given depth. When no | ||
depth is passed, return the type of the innermost parent.</p> | ||
</dd><dt id="user-content-blockcontext.nextline"> | ||
@@ -262,0 +271,0 @@ <code><strong><a href="#user-content-blockcontext.nextline">nextLine</a></strong>() → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt> |
@@ -146,3 +146,3 @@ import {InlineContext, BlockContext, MarkdownConfig, | ||
leaf(cx, leaf) { | ||
return /^\[[ xX]\]/.test(leaf.content) && cx.parser.nodeSet.types[cx.block.type].name == "ListItem" ? new TaskParser : null | ||
return /^\[[ xX]\]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser : null | ||
}, | ||
@@ -149,0 +149,0 @@ after: "SetextHeading" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
371855
9139
680