Skip to content

feat(markdown): highlight frontmatter and comments - #1245

Merged
alecthomas merged 1 commit into
alecthomas:masterfrom
paulopacitti:master
May 2, 2026
Merged

alecthomas merged 1 commit into
alecthomas:masterfrom
paulopacitti:master

Conversation

@paulopacitti

Copy link
Copy Markdown
Contributor

Adds Markdown frontmatter and HTML comment highlighting, including a dedicated frontmatter split path for top-of-file YAML blocks. Also updates gruvbox themes so frontmatter tokens render consistently, with tests covering the new tokenization.

* Improve Markdown lexer to recognize a leading YAML frontmatter block and inline HTML comments, then add coverage for the new tokenization behavior.
* Also map NameNamespace in the gruvbox themes so frontmatter renders consistently.
@toastal

toastal commented May 1, 2026

Copy link
Copy Markdown

“frontmatter” isn’t a part of the Markdown spec.

@alecthomas

Copy link
Copy Markdown
Owner

@toastal I'm not sure how that comment is relevant to a syntax highlighter. Our goal is to give a good user experience, not be spec compliant.

@alecthomas

Copy link
Copy Markdown
Owner

@paulopacitti thanks!

@alecthomas
alecthomas merged commit d46ce60 into alecthomas:master May 2, 2026
2 checks passed
Maks1mS pushed a commit to stplr-dev/stplr that referenced this pull request May 29, 2026
…#442)

This PR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) | require | minor | `v2.24.1` → `v2.26.1` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/alecthomas/chroma/badge)](https://securityscorecards.dev/viewer/?uri=github.com/alecthomas/chroma) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information.

---

### Release Notes

<details>
<summary>alecthomas/chroma (github.com/alecthomas/chroma/v2)</summary>

### [`v2.26.1`](https://github.com/alecthomas/chroma/releases/tag/v2.26.1)

[Compare Source](alecthomas/chroma@v2.26.0...v2.26.1)

#### Changelog

- [`56c7702`](alecthomas/chroma@56c7702) fix: downgrade go.mod version to 1.25

### [`v2.26.0`](https://github.com/alecthomas/chroma/releases/tag/v2.26.0)

[Compare Source](alecthomas/chroma@v2.25.0...v2.26.0)

#### Changelog

- [`a4d3f60`](alecthomas/chroma@a4d3f60) feat(chromad): use style counterparts for theme switching
- [`ce159e6`](alecthomas/chroma@ce159e6) chore: migrate to new bit format
- [`180ea9f`](alecthomas/chroma@180ea9f) perf(colour): replace Sprintf/ParseUint round-trip in NewColour with direct bit arithmetic ([#&#8203;1274](alecthomas/chroma#1274))
- [`68a08b0`](alecthomas/chroma@68a08b0) docs: how to support dynamic theme switching
- [`6fb9d92`](alecthomas/chroma@6fb9d92) feat(html): tag output with style mode
- [`a71fea3`](alecthomas/chroma@a71fea3) feat(styles): add light/dark mode support

### [`v2.25.0`](https://github.com/alecthomas/chroma/releases/tag/v2.25.0)

[Compare Source](alecthomas/chroma@v2.24.1...v2.25.0)

#### Changelog

- [`c3826f0`](alecthomas/chroma@c3826f0) chore: go mod tidy
- [`fb5bc39`](alecthomas/chroma@fb5bc39) fix: emit HTTP body tokens without Coalesce
- [`a3c2946`](alecthomas/chroma@a3c2946) Improve Nu file detection ([#&#8203;1260](alecthomas/chroma#1260))
- [`e841b1a`](alecthomas/chroma@e841b1a) chore(deps): update all non-major dependencies ([#&#8203;1272](alecthomas/chroma#1272))
- [`3ed2db8`](alecthomas/chroma@3ed2db8) Add Gemfile.lock lexer (& ruby improvements) ([#&#8203;1269](alecthomas/chroma#1269))
- [`41fb546`](alecthomas/chroma@41fb546) Add YAML+Jinja lexer ([#&#8203;1268](alecthomas/chroma#1268))
- [`e99b881`](alecthomas/chroma@e99b881) chore(deps): update all non-major dependencies ([#&#8203;1263](alecthomas/chroma#1263))
- [`e67dd2f`](alecthomas/chroma@e67dd2f) (Markless) Fix parse issue for embed directives without options ([#&#8203;1266](alecthomas/chroma#1266))
- [`dffa370`](alecthomas/chroma@dffa370) fix(go): tokenize trailing // as comment instead of consuming next line ([#&#8203;1265](alecthomas/chroma#1265))
- [`1cf1560`](alecthomas/chroma@1cf1560) chore: upgrade to github.com/dlclark/regexp2/v2
- [`2cbcf7b`](alecthomas/chroma@2cbcf7b) chore: upgrade golangci-lint
- [`786675b`](alecthomas/chroma@786675b) chore(deps): update all non-major dependencies ([#&#8203;1257](alecthomas/chroma#1257))
- [`235590c`](alecthomas/chroma@235590c) feat: add JSONL support to JSON lexer ([#&#8203;1262](alecthomas/chroma#1262))
- [`f9b5c97`](alecthomas/chroma@f9b5c97) fix(dart): match single-line comments without trailing newline ([#&#8203;1225](alecthomas/chroma#1225)) ([#&#8203;1261](alecthomas/chroma#1261))
- [`097f8e9`](alecthomas/chroma@097f8e9) Mention Arturo in README ([#&#8203;1256](alecthomas/chroma#1256))
- [`d46ce60`](alecthomas/chroma@d46ce60) feat(markdown): highlight frontmatter and comments ([#&#8203;1245](alecthomas/chroma#1245))
- [`f786b2a`](alecthomas/chroma@f786b2a) feat(lexers): add support for LilyPond ([#&#8203;1255](alecthomas/chroma#1255))
- [`0a02b98`](alecthomas/chroma@0a02b98) chore(deps): update actions/checkout digest to [`de0fac2`](alecthomas/chroma@de0fac2) ([#&#8203;1212](alecthomas/chroma#1212))
- [`c55009e`](alecthomas/chroma@c55009e) Fix AGENTS.md referencing a non-existent scripts directory ([#&#8203;1231](alecthomas/chroma#1231))
- [`c5e763e`](alecthomas/chroma@c5e763e) Improve protobuf lexer ([#&#8203;1253](alecthomas/chroma#1253))
- [`113cd0e`](alecthomas/chroma@113cd0e) Add Arturo lexer ([#&#8203;1232](alecthomas/chroma#1232))
- [`4498d71`](alecthomas/chroma@4498d71) chore(deps): update dependency binaryen to v129 ([#&#8203;1238](alecthomas/chroma#1238))
- [`885f912`](alecthomas/chroma@885f912) Added f4 to "Projects using Chroma" list ([#&#8203;1242](alecthomas/chroma#1242))
- [`c42c9ef`](alecthomas/chroma@c42c9ef) Update java lexer ([#&#8203;1254](alecthomas/chroma#1254))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`)
  - Only on Sunday and Saturday (`* * * * 0,6`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xOTUuMyIsInVwZGF0ZWRJblZlciI6IjQzLjE5NS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://altlinux.space/stapler/stplr/pulls/442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址