From 66fad7edb3b67afa596713bc678d1b299755da1b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 4 Oct 2024 13:42:22 +0200 Subject: [PATCH 1/8] Update dev-dependencies --- package.json | 8 +- readme.md | 230 +++++++++++++++++++++++++-------------------------- 2 files changed, 119 insertions(+), 119 deletions(-) diff --git a/package.json b/package.json index 29da553..de85a21 100644 --- a/package.json +++ b/package.json @@ -13,16 +13,16 @@ "Christian Murphy " ], "devDependencies": { - "remark-cli": "^11.0.0", - "remark-preset-wooorm": "^9.0.0" + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0" }, "scripts": { - "format": "remark . -qfo", + "format": "remark --frail --output --quiet -- .", "test": "npm run format" }, "remarkConfig": { "plugins": [ - "preset-wooorm" + "remark-preset-wooorm" ] } } diff --git a/readme.md b/readme.md index 263b5be..d914c40 100644 --- a/readme.md +++ b/readme.md @@ -15,22 +15,22 @@ The latest released version is [`3.0.0`][release]. ## Contents -* [Intro](#intro) - * [Syntax tree](#syntax-tree) - * [Where this specification fits](#where-this-specification-fits) -* [Types](#types) -* [Nodes](#nodes) - * [`Node`](#node) - * [`Parent`](#parent) - * [`Literal`](#literal) -* [Glossary](#glossary) -* [Tree traversal](#tree-traversal) -* [Utilities](#utilities) - * [List of utilities](#list-of-utilities) -* [References](#references) -* [Contribute](#contribute) -* [Acknowledgments](#acknowledgments) -* [License](#license) +* [Intro](#intro) + * [Syntax tree](#syntax-tree) + * [Where this specification fits](#where-this-specification-fits) +* [Types](#types) +* [Nodes](#nodes) + * [`Node`](#node) + * [`Parent`](#parent) + * [`Literal`](#literal) +* [Glossary](#glossary) +* [Tree traversal](#tree-traversal) +* [Utilities](#utilities) + * [List of utilities](#list-of-utilities) +* [References](#references) +* [Contribute](#contribute) +* [Acknowledgments](#acknowledgments) +* [License](#license) ## Intro @@ -46,11 +46,11 @@ generate code. Syntax trees [come in two flavors][abstract-vs-concrete-trees]: -* **concrete syntax trees**: structures that represent every detail (such as - white-space in white-space insensitive languages) -* **abstract syntax trees**: structures that only represent details relating - to the syntactic structure of code (such as ignoring whether a double or - single quote was used in languages that support both, such as JavaScript). +* **concrete syntax trees**: structures that represent every detail (such as + white-space in white-space insensitive languages) +* **abstract syntax trees**: structures that only represent details relating + to the syntactic structure of code (such as ignoring whether a double or + single quote was used in languages that support both, such as JavaScript). This specification can express both abstract and concrete syntax trees. @@ -316,20 +316,20 @@ For example, see projects such as **[vfile][]**. In **preorder** (**NLR**) is [depth-first][traversal-depth] [tree traversal][traversal] that performs the following steps for each node *N*: -1. **N**: visit *N* itself -2. **L**: traverse *[head][term-head]* (then its *next sibling*, recursively - moving forward until reaching *tail*) -3. **R**: traverse *[tail][term-tail]* +1. **N**: visit *N* itself +2. **L**: traverse *[head][term-head]* (then its *next sibling*, recursively + moving forward until reaching *tail*) +3. **R**: traverse *[tail][term-tail]* ###### Postorder In **postorder** (**LRN**) is [depth-first][traversal-depth] [tree traversal][traversal] that performs the following steps for each node *N*: -1. **L**: traverse *[head][term-head]* (then its *next sibling*, recursively - moving forward until reaching *tail*) -2. **R**: traverse *[tail][term-tail]* -3. **N**: visit *N* itself +1. **L**: traverse *[head][term-head]* (then its *next sibling*, recursively + moving forward until reaching *tail*) +2. **R**: traverse *[tail][term-tail]* +3. **N**: visit *N* itself ###### Enter @@ -387,9 +387,9 @@ For a given node *N* with *[children][term-child]*, a **depth-first traversal** performs three steps, simplified to only binary trees (every node has *[head][term-head]* and *[tail][term-tail]*, but no other children): -* **N**: visit *N* itself -* **L**: traverse *[head][term-head]* -* **R**: traverse *[tail][term-tail]* +* **N**: visit *N* itself +* **L**: traverse *[head][term-head]* +* **R**: traverse *[tail][term-tail]* These steps can be done in any order, but for non-binary trees, **L** and **R** occur together. @@ -420,95 +420,95 @@ sibling (**F**) is traversed and then finally its only child (**G**). There are several projects that deal with nodes from specifications implementing unist: -* [hast utilities](https://github.com/syntax-tree/hast#list-of-utilities) -* [mdast utilities](https://github.com/syntax-tree/mdast#list-of-utilities) -* [nlcst utilities](https://github.com/syntax-tree/nlcst#list-of-utilities) -* [xast utilities](https://github.com/syntax-tree/xast#list-of-utilities) +* [hast utilities](https://github.com/syntax-tree/hast#list-of-utilities) +* [mdast utilities](https://github.com/syntax-tree/mdast#list-of-utilities) +* [nlcst utilities](https://github.com/syntax-tree/nlcst#list-of-utilities) +* [xast utilities](https://github.com/syntax-tree/xast#list-of-utilities) ### List of utilities -* [`unist-util-ancestor`](https://github.com/gorango/unist-util-ancestor) - — get the common ancestor of one or more nodes -* [`unist-util-assert`](https://github.com/syntax-tree/unist-util-assert) - — assert nodes -* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) - — create a new tree with all nodes that pass the given function -* [`unist-util-find`](https://github.com/blahah/unist-util-find) - — find a node by condition -* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) - — find a node after another node -* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) - — find nodes after another node or index -* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) - — find nodes before another node or index -* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) - — find nodes between two nodes or positions -* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) - — find a node before another node -* [`unist-util-flat-filter`](https://github.com/unicorn-utterances/unist-util-flat-filter) - — flat map version of `unist-util-filter` -* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) - — create a new tree by expanding a node into many -* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) - — check if a node is generated -* [`unist-util-index`](https://github.com/syntax-tree/unist-util-index) - — index nodes by property or computed key -* [`unist-util-inspect`](https://github.com/syntax-tree/unist-util-inspect) - — node inspector -* [`unist-util-is`](https://github.com/syntax-tree/unist-util-is) - — check if a node passes a test -* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) - — create a new tree by mapping nodes -* [`unist-util-modify-children`](https://github.com/syntax-tree/unist-util-modify-children) - — modify direct children of a parent -* [`unist-util-parents`](https://github.com/syntax-tree/unist-util-parents) - — `parent` references on nodes -* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) - — get positional info of nodes -* [`unist-util-reduce`](https://github.com/GenerousLabs/unist-util-reduce) - — recursively reduce a tree -* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) - — remove nodes from trees -* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) - — remove positional info from trees -* [`unist-util-replace-all-between`](https://github.com/unicorn-utterances/unist-util-replace-all-between) - — replace nodes between two nodes or positions -* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) - — select nodes with CSS-like selectors -* [`unist-util-size`](https://github.com/syntax-tree/unist-util-size) - — calculate the number of nodes in a tree -* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) - — get the source of a value (node or position) in a file -* [`unist-util-stringify-position`](https://github.com/syntax-tree/unist-util-stringify-position) - — stringify a node, position, or point -* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) - — recursively walk over nodes -* [`unist-util-visit-parents`](https://github.com/syntax-tree/unist-util-visit-parents) - — recursively walk over nodes, with a stack of parents -* [`unist-util-visit-children`](https://github.com/syntax-tree/unist-util-visit-children) - — visit direct children of a parent -* [`unist-util-visit-all-after`](https://github.com/mrzmmr/unist-util-visit-all-after) - — visit nodes after another node -* [`unist-builder`](https://github.com/syntax-tree/unist-builder) - — helper for creating trees +* [`unist-util-ancestor`](https://github.com/gorango/unist-util-ancestor) + — get the common ancestor of one or more nodes +* [`unist-util-assert`](https://github.com/syntax-tree/unist-util-assert) + — assert nodes +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — create a new tree with all nodes that pass the given function +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — find a node by condition +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — find a node after another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — find nodes after another node or index +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — find nodes before another node or index +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — find nodes between two nodes or positions +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — find a node before another node +* [`unist-util-flat-filter`](https://github.com/unicorn-utterances/unist-util-flat-filter) + — flat map version of `unist-util-filter` +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — create a new tree by expanding a node into many +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — check if a node is generated +* [`unist-util-index`](https://github.com/syntax-tree/unist-util-index) + — index nodes by property or computed key +* [`unist-util-inspect`](https://github.com/syntax-tree/unist-util-inspect) + — node inspector +* [`unist-util-is`](https://github.com/syntax-tree/unist-util-is) + — check if a node passes a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — create a new tree by mapping nodes +* [`unist-util-modify-children`](https://github.com/syntax-tree/unist-util-modify-children) + — modify direct children of a parent +* [`unist-util-parents`](https://github.com/syntax-tree/unist-util-parents) + — `parent` references on nodes +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — get positional info of nodes +* [`unist-util-reduce`](https://github.com/GenerousLabs/unist-util-reduce) + — recursively reduce a tree +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — remove nodes from trees +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — remove positional info from trees +* [`unist-util-replace-all-between`](https://github.com/unicorn-utterances/unist-util-replace-all-between) + — replace nodes between two nodes or positions +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — select nodes with CSS-like selectors +* [`unist-util-size`](https://github.com/syntax-tree/unist-util-size) + — calculate the number of nodes in a tree +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — get the source of a value (node or position) in a file +* [`unist-util-stringify-position`](https://github.com/syntax-tree/unist-util-stringify-position) + — stringify a node, position, or point +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — recursively walk over nodes +* [`unist-util-visit-parents`](https://github.com/syntax-tree/unist-util-visit-parents) + — recursively walk over nodes, with a stack of parents +* [`unist-util-visit-children`](https://github.com/syntax-tree/unist-util-visit-children) + — visit direct children of a parent +* [`unist-util-visit-all-after`](https://github.com/mrzmmr/unist-util-visit-all-after) + — visit nodes after another node +* [`unist-builder`](https://github.com/syntax-tree/unist-builder) + — helper for creating trees ## References -* **JavaScript**: - [ECMAScript Language Specification][javascript]. - Ecma International. -* **JSON**: - [The JavaScript Object Notation (JSON) Data Interchange Format][json], - T. Bray. - IETF. -* **XML**: - [Extensible Markup Language][xml], - T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler, F. Yergeau. - W3C. -* **Web IDL**: - [Web IDL][webidl], - C. McCormack. - W3C. +* **JavaScript**: + [ECMAScript Language Specification][javascript]. + Ecma International. +* **JSON**: + [The JavaScript Object Notation (JSON) Data Interchange Format][json], + T. Bray. + IETF. +* **XML**: + [Extensible Markup Language][xml], + T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler, F. Yergeau. + W3C. +* **Web IDL**: + [Web IDL][webidl], + C. McCormack. + W3C. ## Contribute From e09a2ea0f558d4130f629d3ad56b458ec2c20135 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 4 Oct 2024 13:42:45 +0200 Subject: [PATCH 2/8] Refactor Actions --- .github/workflows/bb.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bb.yml b/.github/workflows/bb.yml index 0198fc3..16ca054 100644 --- a/.github/workflows/bb.yml +++ b/.github/workflows/bb.yml @@ -1,9 +1,9 @@ name: bb on: issues: - types: [opened, reopened, edited, closed, labeled, unlabeled] + types: [closed, edited, labeled, opened, reopened, unlabeled] pull_request_target: - types: [opened, reopened, edited, closed, labeled, unlabeled] + types: [closed, edited, labeled, opened, reopened, unlabeled] jobs: main: runs-on: ubuntu-latest From 2abb5f08b565a90b0f4e14bb9211211d8c366263 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 4 Oct 2024 13:42:54 +0200 Subject: [PATCH 3/8] Add `ignore-scripts` to `.npmrc` --- .npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmrc b/.npmrc index 43c97e7..3757b30 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ +ignore-scripts=true package-lock=false From 22b82af80e263db6f55ec31cf031af174ffd9fea Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 4 Oct 2024 13:43:39 +0200 Subject: [PATCH 4/8] Refactor `logo.svg` --- logo.svg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/logo.svg b/logo.svg index 12fa5f9..f5b4736 100644 --- a/logo.svg +++ b/logo.svg @@ -1,4 +1,4 @@ - + - - - + + + From 74531f9583015b173e3cc45b18af94fa31e04043 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 4 Oct 2024 13:45:15 +0200 Subject: [PATCH 5/8] Refactor `package.json` --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index de85a21..87481c3 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,28 @@ { - "private": true, - "version": "0.0.0", - "description": "universal syntax tree", - "license": "CC-BY-4.0", - "keywords": [], - "repository": "syntax-tree/unist", - "bugs": "https://github.com/syntax-tree/unist/issues", "author": "Titus Wormer (wooorm.com)", + "bugs": "https://github.com/syntax-tree/unist/issues", "contributors": [ - "Titus Wormer (wooorm.com)", + "Christian Murphy ", "Eugene Sharygin ", - "Christian Murphy " + "Titus Wormer (wooorm.com)" ], "devDependencies": { "remark-cli": "^12.0.0", "remark-preset-wooorm": "^10.0.0" }, - "scripts": { - "format": "remark --frail --output --quiet -- .", - "test": "npm run format" - }, + "description": "universal syntax tree", + "keywords": [], + "license": "CC-BY-4.0", + "private": true, "remarkConfig": { "plugins": [ "remark-preset-wooorm" ] - } + }, + "repository": "syntax-tree/unist", + "scripts": { + "format": "remark --frail --output --quiet -- .", + "test": "npm run format" + }, + "version": "0.0.0" } From 1310d3090508e7a200c726b1999f9b2a6a3e3bd9 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 4 Oct 2024 13:46:58 +0200 Subject: [PATCH 6/8] Add square logo --- logo-square.svg | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 logo-square.svg diff --git a/logo-square.svg b/logo-square.svg new file mode 100644 index 0000000..19982b6 --- /dev/null +++ b/logo-square.svg @@ -0,0 +1,13 @@ + + + + + + From 1e762357906738f0f062a41a141b4c96e83943d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Talat=20K=C3=BCy=C3=BCk?= Date: Mon, 27 Apr 2026 12:59:46 +0300 Subject: [PATCH 7/8] Add `unist-util-find-between` to list of utilities (#156) --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index d914c40..6a538c2 100644 --- a/readme.md +++ b/readme.md @@ -445,6 +445,8 @@ unist: — find nodes between two nodes or positions * [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) — find a node before another node +* [`unist-util-find-between`](https://github.com/ipikuka/unist-util-find-between) + — find nodes between two nodes or index * [`unist-util-flat-filter`](https://github.com/unicorn-utterances/unist-util-flat-filter) — flat map version of `unist-util-filter` * [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) From 8b10b6113c1463113b879f423d605547e04efd0d Mon Sep 17 00:00:00 2001 From: Goran Date: Mon, 1 Jun 2026 12:10:53 -0400 Subject: [PATCH 8/8] Add `unist-util-distance` to list of utilities Closes GH-154. Reviewed-by: Remco Haszing --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 6a538c2..e57909f 100644 --- a/readme.md +++ b/readme.md @@ -431,6 +431,8 @@ unist: — get the common ancestor of one or more nodes * [`unist-util-assert`](https://github.com/syntax-tree/unist-util-assert) — assert nodes +* [`unist-util-distance`](https://github.com/gorango/unist-util-distance) + — find the distance between two nodes * [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) — create a new tree with all nodes that pass the given function * [`unist-util-find`](https://github.com/blahah/unist-util-find)