Skip to content

Commit 7a8b9ba

Browse files
feat: add support for inline blocks
1 parent 3ea6c93 commit 7a8b9ba

File tree

5 files changed

+42813
-38286
lines changed

5 files changed

+42813
-38286
lines changed

grammar.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,17 @@ org_grammar = {
9191
token(']]')
9292
),
9393

94-
priority: $ => seq(
95-
token('[#'),
96-
field('value', alias(/[A-Za-z0-9]+/, $.expr)),
97-
token.immediate(']')
94+
priority: _ => token(/\[#\w+\]/),
95+
96+
inline_code_block: $ => seq(
97+
field('open', alias($._inline_code_open, $.open)),
98+
field('contents', alias(repeat($.expr), $.contents)),
99+
field('close', alias(choice(token('}'), token.immediate('}')), $.close))
100+
),
101+
102+
_inline_code_open: $ => choice(
103+
token(/src_[^\s\[\{]+\{/),
104+
token(/src_[^\s\[\{]+\[[^\r\n\[\]]*\]\{/)
98105
),
99106

100107
// Can't have multiple in a row
@@ -358,6 +365,7 @@ org_grammar = {
358365

359366
_markup: $ => choice(
360367
$.expr,
368+
$.inline_code_block,
361369
$.link,
362370
$.link_desc,
363371
$.timestamp,

src/grammar.json

Lines changed: 70 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 73 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)