Refactor prose · syntax-tree/unist@19dbf5f (original) (raw)

`@@ -40,13 +40,13 @@ This specification is written in a [Web IDL][webidl]-like grammar.

`

40

40

`### Syntax tree

`

41

41

``

42

42

`Syntax trees are representations of source code or even natural language.

`

43

``

`-

These trees are abstractions that make it possible to analyse, transform,

`

44

``

`-

and generate code.

`

``

43

`+

These trees are abstractions that make it possible to analyse, transform, and

`

``

44

`+

generate code.

`

45

45

``

46

46

`Syntax trees [come in two flavours][abstract-vs-concrete-trees]:

`

47

47

``

48

``

`-

`

49

``

`-

as white-space in white-space insensitive languages)

`

``

48

`+

`

``

49

`+

white-space in white-space insensitive languages)

`

50

50

`* abstract syntax trees: structures that only represent details relating

`

51

51

` to the syntactic structure of code (such as ignoring whether a double or

`

52

52

` single quote was used in languages that support both, such as JavaScript).

`

`@@ -56,9 +56,9 @@ This specification can express both abstract and concrete syntax trees.

`

56

56

`### Where this specification fits

`

57

57

``

58

58

`unist is not intended to be self-sufficient.

`

59

``

`-

Instead, it is expected that other specifications implement unist and extend

`

60

``

`-

it to express language specific nodes.

`

61

``

`-

For example, see projects such as [mdast][mdast] (for markdown),

`

``

59

`+

Instead, it is expected that other specifications implement unist and extend it

`

``

60

`+

to express language specific nodes.

`

``

61

`+

For example, see projects such as [mdast][mdast] (for Markdown),

`

62

62

`[hast][hast] (for HTML), and [nlcst][nlcst] (for natural language).

`

63

63

``

64

64

`unist relates to [JSON][] in that compliant syntax trees can be expressed

`

`@@ -71,15 +71,15 @@ utilities][list-of-utilities] for working with compliant syntax trees in

`

71

71

`JavaScript.

`

72

72

`The five most used utilities combined are downloaded ten million times each

`

73

73

`month.

`

74

``

`-

However, unist is not limited to JavaScript and can be used in other

`

75

``

`-

programming languages.

`

``

74

`+

However, unist is not limited to JavaScript and can be used in other programming

`

``

75

`+

languages.

`

76

76

``

77

77

`unist relates to the [unified][], [remark][], [rehype][], and [retext][]

`

78

78

`projects in that unist syntax trees are used throughout their ecosystems.

`

79

79

``

80

``

`-

unist relates to the [vfile][] project in that it accepts unist nodes for

`

81

``

`-

its message store, and that vfile can be a source [file][term-file] of a

`

82

``

`-

syntax tree.

`

``

80

`+

unist relates to the [vfile][] project in that it accepts unist nodes for its

`

``

81

`+

message store, and that vfile can be a source [file][term-file] of a syntax

`

``

82

`+

tree.

`

83

83

``

84

84

`## Nodes

`

85

85

``

`@@ -130,8 +130,8 @@ interface Position {

`

130

130

``

131

131

`Position represents the location of a node in a source [file][term-file].

`

132

132

``

133

``

`` -

The start field of Position represents the place of the first character

``

134

``

`-

of the parsed source region.

`

``

133

`` +

The start field of Position represents the place of the first character of

``

``

134

`+

the parsed source region.

`

135

135

`` The end field of Position represents the place of the first character

``

136

136

`after the parsed source region, whether it exists or not.

`

137

137

`` The value of the start and end fields implement the [Point][dfn-point]

``

`@@ -155,8 +155,8 @@ bravo

`

155

155

`` end at line 1, column 6, offset 5.

``

156

156

`` The line feed would start at line 1, column 6, offset 5, and end at line

``

157

157

`` 2, column 1, offset 6.

``

158

``

`` -

The last word (bravo) would start at line 2, column 1, offset 6, and

``

159

``

`` -

end at line 2, column 6, offset 11.

``

``

158

`` +

The last word (bravo) would start at line 2, column 1, offset 6, and end

``

``

159

`` +

at line 2, column 6, offset 11.

``

160

160

``

161

161

`` #### Point

``

162

162

``

`@@ -421,8 +421,8 @@ sibling (F) is traversed and then finally its only child (G).

`

421

421

``

422

422

`Utilities are functions that work with nodes.

`

423

423

``

424

``

`-

There are several projects that deal with nodes from specifications

`

425

``

`-

implementing unist:

`

``

424

`+

There are several projects that deal with nodes from specifications implementing

`

``

425

`+

unist:

`

426

426

``

427

427

`* mdast utilities

`

428

428

`* hast utilities

`

`@@ -493,18 +493,18 @@ implementing unist:

`

493

493

``

494

494

`## References

`

495

495

``

496

``

`-

`

``

496

`+

`

497

497

`[ECMAScript Language Specification][javascript].

`

498

498

` Ecma International.

`

499

``

`-

`

``

499

`+

`

500

500

`[The JavaScript Object Notation (JSON) Data Interchange Format][json],

`

501

501

` T. Bray.

`

502

502

` IETF.

`

503

``

`-

`

``

503

`+

`

504

504

`[Extensible Markup Language][xml],

`

505

505

` T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler, F. Yergeau.

`

506

506

` W3C.

`

507

``

`-

`

``

507

`+

`

508

508

`[Web IDL][webidl],

`

509

509

` C. McCormack.

`

510

510

` W3C.

`

`@@ -591,7 +591,7 @@ for contributing to unist and related projects!

`

591

591

``

592

592

`[license]: https://creativecommons.org/licenses/by/4.0/

`

593

593

``

594

``

`-

`

``

594

`+

`

595

595

``

596

596

`[release]: https://github.com/syntax-tree/unist/releases/tag/2.0.0

`

597

597

``