# Inconsistent const syntax highlighting in an ojs code block

**URL:** <https://talk.observablehq.com/t/inconsistent-const-syntax-highlighting-in-an-ojs-code-block/11030>\
**Category:** Feedback\
**Created:** [November 30, 2026, 10:17pm UTC](https://talk.observablehq.com/t/inconsistent-const-syntax-highlighting-in-an-ojs-code-block/11030 "2026-11-30T22:17:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![subairui](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/subairui/32/9631_2.png) [@subairui](https://talk.observablehq.com/u/subairui)\
**Post date:** [November 30, 2026, 10:17pm UTC](https://talk.observablehq.com/t/inconsistent-const-syntax-highlighting-in-an-ojs-code-block/11030/1 "2026-11-30T22:17:58Z")

</div>

When I was reviewing some D3 examples, I found that the color of the first _ **const** _ keyword is different from that of the rest in an ojs block! [https://observablehq.com/@d3/bar-chart/2](https://observablehq.com/@d3/bar-chart/2)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/4/4be17b325031b3f2ccfec888b8f0181ef31550db.png)

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [November 30, 2026, 10:53pm UTC](https://talk.observablehq.com/t/inconsistent-const-syntax-highlighting-in-an-ojs-code-block/11030/2 "2026-11-30T22:53:10Z")

</div>

Yes, syntax highlighting for Observable JavaScript cells just uses the vanilla JavaScript lexer, so it’s not very accurate.

---

<div class="post-metadata">

**Author:** ![subairui](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/subairui/32/9631_2.png) [@subairui](https://talk.observablehq.com/u/subairui)\
**Post date:** [November 30, 2026, 11:44pm UTC](https://talk.observablehq.com/t/inconsistent-const-syntax-highlighting-in-an-ojs-code-block/11030/3 "2026-11-30T23:44:09Z")

</div>

I see! I also noticed that in a regular tsx cell, `i` is blue in its declaration and dark in the loop condition and increment. Is that intentional?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/b/b6003f24d24aefabc8191018d3586948089d18ae.png)
