svelte-highlight 7.13.0 → 7.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (572) hide show
  1. package/Highlight.svelte +15 -25
  2. package/HighlightAuto.svelte +20 -25
  3. package/HighlightSvelte.svelte +15 -23
  4. package/README.md +54 -0
  5. package/action.js +2 -5
  6. package/core.js +22 -0
  7. package/highlighter.svelte.js +22 -0
  8. package/languages/bibtex.js +2 -2
  9. package/languages/bicep.js +6 -0
  10. package/languages/blade.js +35 -1
  11. package/languages/caddy.js +1 -1
  12. package/languages/cairo.js +15 -0
  13. package/languages/clarity.js +1 -1
  14. package/languages/cue.js +31 -1
  15. package/languages/cypher.js +9 -0
  16. package/languages/d2.js +2 -2
  17. package/languages/dax.d.ts +2 -0
  18. package/languages/dax.js +75 -0
  19. package/languages/dhall.js +7 -0
  20. package/languages/dotenv.js +5 -1
  21. package/languages/fish.js +8 -0
  22. package/languages/gleam.js +7 -0
  23. package/languages/groq.js +19 -0
  24. package/languages/hcl.js +4 -1
  25. package/languages/hlsl.d.ts +2 -0
  26. package/languages/hlsl.js +88 -0
  27. package/languages/html.js +28 -0
  28. package/languages/index.d.ts +20 -0
  29. package/languages/index.js +10 -0
  30. package/languages/jq.d.ts +2 -0
  31. package/languages/jq.js +120 -0
  32. package/languages/jsonnet.js +9 -2
  33. package/languages/just.d.ts +2 -0
  34. package/languages/just.js +120 -0
  35. package/languages/kql.d.ts +2 -0
  36. package/languages/kql.js +122 -0
  37. package/languages/liquid.js +1 -0
  38. package/languages/logql.d.ts +2 -0
  39. package/languages/logql.js +82 -0
  40. package/languages/marko.js +84 -1
  41. package/languages/mdx.js +40 -1
  42. package/languages/move.js +20 -0
  43. package/languages/nickel.js +16 -1
  44. package/languages/nushell.js +23 -0
  45. package/languages/pkl.js +2 -1
  46. package/languages/prisma.js +2 -1
  47. package/languages/promql.js +35 -2
  48. package/languages/pug.js +22 -0
  49. package/languages/razor.js +64 -5
  50. package/languages/rego.d.ts +2 -0
  51. package/languages/rego.js +94 -0
  52. package/languages/rescript.js +70 -2
  53. package/languages/rst.d.ts +2 -0
  54. package/languages/rst.js +144 -0
  55. package/languages/solidity.js +2 -1
  56. package/languages/svelte.js +12 -3
  57. package/languages/templ.d.ts +2 -0
  58. package/languages/templ.js +254 -0
  59. package/languages/toml.js +3 -1
  60. package/languages/typst.d.ts +2 -0
  61. package/languages/typst.js +185 -0
  62. package/languages/v.js +24 -2
  63. package/languages/vue.js +4 -2
  64. package/languages/vyper.js +18 -0
  65. package/languages/wgsl.js +14 -0
  66. package/languages/zig.js +7 -0
  67. package/package.json +11 -2
  68. package/preprocessor.js +373 -0
  69. package/static.d.ts +36 -0
  70. package/static.js +1 -0
  71. package/styles/1c-light.css +1 -1
  72. package/styles/1c-light.js +1 -1
  73. package/styles/3024.css +1 -1
  74. package/styles/3024.js +1 -1
  75. package/styles/a11y-dark.css +1 -1
  76. package/styles/a11y-dark.js +1 -1
  77. package/styles/a11y-light.css +1 -1
  78. package/styles/a11y-light.js +1 -1
  79. package/styles/agate.css +1 -1
  80. package/styles/agate.js +1 -1
  81. package/styles/an-old-hope.css +1 -1
  82. package/styles/an-old-hope.js +1 -1
  83. package/styles/androidstudio.css +1 -1
  84. package/styles/androidstudio.js +1 -1
  85. package/styles/apathy.css +1 -1
  86. package/styles/apathy.js +1 -1
  87. package/styles/apprentice.css +1 -1
  88. package/styles/apprentice.js +1 -1
  89. package/styles/arduino-light.css +1 -1
  90. package/styles/arduino-light.js +1 -1
  91. package/styles/arta.css +1 -1
  92. package/styles/arta.js +1 -1
  93. package/styles/ascetic.css +1 -1
  94. package/styles/ascetic.js +1 -1
  95. package/styles/ashes.css +1 -1
  96. package/styles/ashes.js +1 -1
  97. package/styles/atelier-cave-light.css +1 -1
  98. package/styles/atelier-cave-light.js +1 -1
  99. package/styles/atelier-cave.css +1 -1
  100. package/styles/atelier-cave.js +1 -1
  101. package/styles/atelier-dune-light.css +1 -1
  102. package/styles/atelier-dune-light.js +1 -1
  103. package/styles/atelier-dune.css +1 -1
  104. package/styles/atelier-dune.js +1 -1
  105. package/styles/atelier-estuary-light.css +1 -1
  106. package/styles/atelier-estuary-light.js +1 -1
  107. package/styles/atelier-estuary.css +1 -1
  108. package/styles/atelier-estuary.js +1 -1
  109. package/styles/atelier-forest-light.css +1 -1
  110. package/styles/atelier-forest-light.js +1 -1
  111. package/styles/atelier-forest.css +1 -1
  112. package/styles/atelier-forest.js +1 -1
  113. package/styles/atelier-heath-light.css +1 -1
  114. package/styles/atelier-heath-light.js +1 -1
  115. package/styles/atelier-heath.css +1 -1
  116. package/styles/atelier-heath.js +1 -1
  117. package/styles/atelier-lakeside-light.css +1 -1
  118. package/styles/atelier-lakeside-light.js +1 -1
  119. package/styles/atelier-lakeside.css +1 -1
  120. package/styles/atelier-lakeside.js +1 -1
  121. package/styles/atelier-plateau-light.css +1 -1
  122. package/styles/atelier-plateau-light.js +1 -1
  123. package/styles/atelier-plateau.css +1 -1
  124. package/styles/atelier-plateau.js +1 -1
  125. package/styles/atelier-savanna-light.css +1 -1
  126. package/styles/atelier-savanna-light.js +1 -1
  127. package/styles/atelier-savanna.css +1 -1
  128. package/styles/atelier-savanna.js +1 -1
  129. package/styles/atelier-seaside-light.css +1 -1
  130. package/styles/atelier-seaside-light.js +1 -1
  131. package/styles/atelier-seaside.css +1 -1
  132. package/styles/atelier-seaside.js +1 -1
  133. package/styles/atelier-sulphurpool-light.css +1 -1
  134. package/styles/atelier-sulphurpool-light.js +1 -1
  135. package/styles/atelier-sulphurpool.css +1 -1
  136. package/styles/atelier-sulphurpool.js +1 -1
  137. package/styles/atlas.css +1 -1
  138. package/styles/atlas.js +1 -1
  139. package/styles/atom-one-dark-reasonable.css +1 -1
  140. package/styles/atom-one-dark-reasonable.js +1 -1
  141. package/styles/atom-one-dark.css +1 -1
  142. package/styles/atom-one-dark.js +1 -1
  143. package/styles/atom-one-light.css +1 -1
  144. package/styles/atom-one-light.js +1 -1
  145. package/styles/base16-github.css +1 -1
  146. package/styles/base16-github.js +1 -1
  147. package/styles/base16-ir-black.css +1 -1
  148. package/styles/base16-ir-black.js +1 -1
  149. package/styles/base16-monokai.css +1 -1
  150. package/styles/base16-monokai.js +1 -1
  151. package/styles/base16-nord.css +1 -1
  152. package/styles/base16-nord.js +1 -1
  153. package/styles/bespin.css +1 -1
  154. package/styles/bespin.js +1 -1
  155. package/styles/black-metal-bathory.css +1 -1
  156. package/styles/black-metal-bathory.js +1 -1
  157. package/styles/black-metal-burzum.css +1 -1
  158. package/styles/black-metal-burzum.js +1 -1
  159. package/styles/black-metal-dark-funeral.css +1 -1
  160. package/styles/black-metal-dark-funeral.js +1 -1
  161. package/styles/black-metal-gorgoroth.css +1 -1
  162. package/styles/black-metal-gorgoroth.js +1 -1
  163. package/styles/black-metal-immortal.css +1 -1
  164. package/styles/black-metal-immortal.js +1 -1
  165. package/styles/black-metal-khold.css +1 -1
  166. package/styles/black-metal-khold.js +1 -1
  167. package/styles/black-metal-marduk.css +1 -1
  168. package/styles/black-metal-marduk.js +1 -1
  169. package/styles/black-metal-mayhem.css +1 -1
  170. package/styles/black-metal-mayhem.js +1 -1
  171. package/styles/black-metal-nile.css +1 -1
  172. package/styles/black-metal-nile.js +1 -1
  173. package/styles/black-metal-venom.css +1 -1
  174. package/styles/black-metal-venom.js +1 -1
  175. package/styles/black-metal.css +1 -1
  176. package/styles/black-metal.js +1 -1
  177. package/styles/brewer.css +1 -1
  178. package/styles/brewer.js +1 -1
  179. package/styles/bright.css +1 -1
  180. package/styles/bright.js +1 -1
  181. package/styles/brogrammer.css +1 -1
  182. package/styles/brogrammer.js +1 -1
  183. package/styles/brown-paper.css +1 -1
  184. package/styles/brown-paper.js +1 -1
  185. package/styles/brush-trees-dark.css +1 -1
  186. package/styles/brush-trees-dark.js +1 -1
  187. package/styles/brush-trees.css +1 -1
  188. package/styles/brush-trees.js +1 -1
  189. package/styles/chalk.css +1 -1
  190. package/styles/chalk.js +1 -1
  191. package/styles/circus.css +1 -1
  192. package/styles/circus.js +1 -1
  193. package/styles/classic-dark.css +1 -1
  194. package/styles/classic-dark.js +1 -1
  195. package/styles/classic-light.css +1 -1
  196. package/styles/classic-light.js +1 -1
  197. package/styles/codepen-embed.css +1 -1
  198. package/styles/codepen-embed.js +1 -1
  199. package/styles/codeschool.css +1 -1
  200. package/styles/codeschool.js +1 -1
  201. package/styles/color-brewer.css +1 -1
  202. package/styles/color-brewer.js +1 -1
  203. package/styles/colors.css +1 -1
  204. package/styles/colors.js +1 -1
  205. package/styles/cupcake.css +1 -1
  206. package/styles/cupcake.js +1 -1
  207. package/styles/cupertino.css +1 -1
  208. package/styles/cupertino.js +1 -1
  209. package/styles/danqing.css +1 -1
  210. package/styles/danqing.js +1 -1
  211. package/styles/darcula.css +1 -1
  212. package/styles/darcula.js +1 -1
  213. package/styles/dark-violet.css +1 -1
  214. package/styles/dark-violet.js +1 -1
  215. package/styles/dark.css +1 -1
  216. package/styles/dark.js +1 -1
  217. package/styles/darkmoss.css +1 -1
  218. package/styles/darkmoss.js +1 -1
  219. package/styles/darktooth.css +1 -1
  220. package/styles/darktooth.js +1 -1
  221. package/styles/decaf.css +1 -1
  222. package/styles/decaf.js +1 -1
  223. package/styles/default-dark.css +1 -1
  224. package/styles/default-dark.js +1 -1
  225. package/styles/default-light.css +1 -1
  226. package/styles/default-light.js +1 -1
  227. package/styles/default.css +1 -1
  228. package/styles/default.js +1 -1
  229. package/styles/devibeans.css +1 -1
  230. package/styles/devibeans.js +1 -1
  231. package/styles/dirtysea.css +1 -1
  232. package/styles/dirtysea.js +1 -1
  233. package/styles/docco.css +1 -1
  234. package/styles/docco.js +1 -1
  235. package/styles/dracula.css +1 -1
  236. package/styles/dracula.js +1 -1
  237. package/styles/edge-dark.css +1 -1
  238. package/styles/edge-dark.js +1 -1
  239. package/styles/edge-light.css +1 -1
  240. package/styles/edge-light.js +1 -1
  241. package/styles/eighties.css +1 -1
  242. package/styles/eighties.js +1 -1
  243. package/styles/embers.css +1 -1
  244. package/styles/embers.js +1 -1
  245. package/styles/equilibrium-dark.css +1 -1
  246. package/styles/equilibrium-dark.js +1 -1
  247. package/styles/equilibrium-gray-dark.css +1 -1
  248. package/styles/equilibrium-gray-dark.js +1 -1
  249. package/styles/equilibrium-gray-light.css +1 -1
  250. package/styles/equilibrium-gray-light.js +1 -1
  251. package/styles/equilibrium-light.css +1 -1
  252. package/styles/equilibrium-light.js +1 -1
  253. package/styles/espresso.css +1 -1
  254. package/styles/espresso.js +1 -1
  255. package/styles/eva-dim.css +1 -1
  256. package/styles/eva-dim.js +1 -1
  257. package/styles/eva.css +1 -1
  258. package/styles/eva.js +1 -1
  259. package/styles/far.css +1 -1
  260. package/styles/far.js +1 -1
  261. package/styles/felipec.css +1 -1
  262. package/styles/felipec.js +1 -1
  263. package/styles/flat.css +1 -1
  264. package/styles/flat.js +1 -1
  265. package/styles/foundation.css +1 -1
  266. package/styles/foundation.js +1 -1
  267. package/styles/framer.css +1 -1
  268. package/styles/framer.js +1 -1
  269. package/styles/fruit-soda.css +1 -1
  270. package/styles/fruit-soda.js +1 -1
  271. package/styles/gigavolt.css +1 -1
  272. package/styles/gigavolt.js +1 -1
  273. package/styles/github-dark-dimmed.css +1 -1
  274. package/styles/github-dark-dimmed.js +1 -1
  275. package/styles/github-dark.css +1 -1
  276. package/styles/github-dark.js +1 -1
  277. package/styles/github.css +1 -1
  278. package/styles/github.js +1 -1
  279. package/styles/gml.css +1 -1
  280. package/styles/gml.js +1 -1
  281. package/styles/google-dark.css +1 -1
  282. package/styles/google-dark.js +1 -1
  283. package/styles/google-light.css +1 -1
  284. package/styles/google-light.js +1 -1
  285. package/styles/googlecode.css +1 -2
  286. package/styles/googlecode.js +1 -2
  287. package/styles/gradient-dark.css +2 -3
  288. package/styles/gradient-dark.js +2 -3
  289. package/styles/gradient-light.css +2 -3
  290. package/styles/gradient-light.js +2 -3
  291. package/styles/grayscale-dark.css +1 -1
  292. package/styles/grayscale-dark.js +1 -1
  293. package/styles/grayscale-light.css +1 -1
  294. package/styles/grayscale-light.js +1 -1
  295. package/styles/grayscale.css +1 -1
  296. package/styles/grayscale.js +1 -1
  297. package/styles/green-screen.css +1 -1
  298. package/styles/green-screen.js +1 -1
  299. package/styles/gruvbox-dark-hard.css +1 -1
  300. package/styles/gruvbox-dark-hard.js +1 -1
  301. package/styles/gruvbox-dark-medium.css +1 -1
  302. package/styles/gruvbox-dark-medium.js +1 -1
  303. package/styles/gruvbox-dark-pale.css +1 -1
  304. package/styles/gruvbox-dark-pale.js +1 -1
  305. package/styles/gruvbox-dark-soft.css +1 -1
  306. package/styles/gruvbox-dark-soft.js +1 -1
  307. package/styles/gruvbox-light-hard.css +1 -1
  308. package/styles/gruvbox-light-hard.js +1 -1
  309. package/styles/gruvbox-light-medium.css +1 -1
  310. package/styles/gruvbox-light-medium.js +1 -1
  311. package/styles/gruvbox-light-soft.css +1 -1
  312. package/styles/gruvbox-light-soft.js +1 -1
  313. package/styles/hardcore.css +1 -1
  314. package/styles/hardcore.js +1 -1
  315. package/styles/harmonic16-dark.css +1 -1
  316. package/styles/harmonic16-dark.js +1 -1
  317. package/styles/harmonic16-light.css +1 -1
  318. package/styles/harmonic16-light.js +1 -1
  319. package/styles/heetch-dark.css +1 -1
  320. package/styles/heetch-dark.js +1 -1
  321. package/styles/heetch-light.css +1 -1
  322. package/styles/heetch-light.js +1 -1
  323. package/styles/helios.css +1 -1
  324. package/styles/helios.js +1 -1
  325. package/styles/hopscotch.css +1 -1
  326. package/styles/hopscotch.js +1 -1
  327. package/styles/horizon-dark.css +1 -1
  328. package/styles/horizon-dark.js +1 -1
  329. package/styles/horizon-light.css +1 -1
  330. package/styles/horizon-light.js +1 -1
  331. package/styles/humanoid-dark.css +1 -1
  332. package/styles/humanoid-dark.js +1 -1
  333. package/styles/humanoid-light.css +1 -1
  334. package/styles/humanoid-light.js +1 -1
  335. package/styles/hybrid.css +1 -1
  336. package/styles/hybrid.js +1 -1
  337. package/styles/ia-dark.css +1 -1
  338. package/styles/ia-dark.js +1 -1
  339. package/styles/ia-light.css +1 -1
  340. package/styles/ia-light.js +1 -1
  341. package/styles/icy-dark.css +1 -1
  342. package/styles/icy-dark.js +1 -1
  343. package/styles/idea.css +1 -1
  344. package/styles/idea.js +1 -1
  345. package/styles/intellij-light.css +1 -1
  346. package/styles/intellij-light.js +1 -1
  347. package/styles/ir-black.css +1 -1
  348. package/styles/ir-black.js +1 -1
  349. package/styles/isbl-editor-dark.css +1 -1
  350. package/styles/isbl-editor-dark.js +1 -1
  351. package/styles/isbl-editor-light.css +1 -1
  352. package/styles/isbl-editor-light.js +1 -1
  353. package/styles/isotope.css +1 -1
  354. package/styles/isotope.js +1 -1
  355. package/styles/kimber.css +1 -1
  356. package/styles/kimber.js +1 -1
  357. package/styles/kimbie-dark.css +1 -1
  358. package/styles/kimbie-dark.js +1 -1
  359. package/styles/kimbie-light.css +1 -1
  360. package/styles/kimbie-light.js +1 -1
  361. package/styles/lightfair.css +1 -1
  362. package/styles/lightfair.js +1 -1
  363. package/styles/lioshi.css +1 -1
  364. package/styles/lioshi.js +1 -1
  365. package/styles/london-tube.css +1 -1
  366. package/styles/london-tube.js +1 -1
  367. package/styles/macintosh.css +1 -1
  368. package/styles/macintosh.js +1 -1
  369. package/styles/magula.css +1 -2
  370. package/styles/magula.js +1 -2
  371. package/styles/marrakesh.css +1 -1
  372. package/styles/marrakesh.js +1 -1
  373. package/styles/materia.css +1 -1
  374. package/styles/materia.js +1 -1
  375. package/styles/material-darker.css +1 -1
  376. package/styles/material-darker.js +1 -1
  377. package/styles/material-lighter.css +1 -1
  378. package/styles/material-lighter.js +1 -1
  379. package/styles/material-palenight.css +1 -1
  380. package/styles/material-palenight.js +1 -1
  381. package/styles/material-vivid.css +1 -1
  382. package/styles/material-vivid.js +1 -1
  383. package/styles/material.css +1 -1
  384. package/styles/material.js +1 -1
  385. package/styles/mellow-purple.css +1 -1
  386. package/styles/mellow-purple.js +1 -1
  387. package/styles/mexico-light.css +1 -1
  388. package/styles/mexico-light.js +1 -1
  389. package/styles/mocha.css +1 -1
  390. package/styles/mocha.js +1 -1
  391. package/styles/mono-blue.css +1 -1
  392. package/styles/mono-blue.js +1 -1
  393. package/styles/monokai-sublime.css +1 -1
  394. package/styles/monokai-sublime.js +1 -1
  395. package/styles/monokai.css +1 -1
  396. package/styles/monokai.js +1 -1
  397. package/styles/nebula.css +1 -1
  398. package/styles/nebula.js +1 -1
  399. package/styles/night-owl.css +1 -1
  400. package/styles/night-owl.js +1 -1
  401. package/styles/nnfx-dark.css +1 -1
  402. package/styles/nnfx-dark.js +1 -1
  403. package/styles/nnfx-light.css +1 -1
  404. package/styles/nnfx-light.js +1 -1
  405. package/styles/nord.css +1 -1
  406. package/styles/nord.js +1 -1
  407. package/styles/nova.css +1 -1
  408. package/styles/nova.js +1 -1
  409. package/styles/obsidian.css +1 -1
  410. package/styles/obsidian.js +1 -1
  411. package/styles/ocean.css +1 -1
  412. package/styles/ocean.js +1 -1
  413. package/styles/oceanicnext.css +1 -1
  414. package/styles/oceanicnext.js +1 -1
  415. package/styles/one-light.css +1 -1
  416. package/styles/one-light.js +1 -1
  417. package/styles/onedark.css +1 -1
  418. package/styles/onedark.js +1 -1
  419. package/styles/outrun-dark.css +1 -1
  420. package/styles/outrun-dark.js +1 -1
  421. package/styles/panda-syntax-dark.css +1 -2
  422. package/styles/panda-syntax-dark.js +1 -2
  423. package/styles/papercolor-dark.css +1 -1
  424. package/styles/papercolor-dark.js +1 -1
  425. package/styles/papercolor-light.css +1 -1
  426. package/styles/papercolor-light.js +1 -1
  427. package/styles/paraiso-dark.css +1 -1
  428. package/styles/paraiso-dark.js +1 -1
  429. package/styles/paraiso-light.css +1 -1
  430. package/styles/paraiso-light.js +1 -1
  431. package/styles/paraiso.css +1 -1
  432. package/styles/paraiso.js +1 -1
  433. package/styles/pasque.css +1 -1
  434. package/styles/pasque.js +1 -1
  435. package/styles/phd.css +1 -1
  436. package/styles/phd.js +1 -1
  437. package/styles/pico.css +1 -1
  438. package/styles/pico.js +1 -1
  439. package/styles/pojoaque.css +1 -1
  440. package/styles/pojoaque.js +1 -1
  441. package/styles/pop.css +1 -1
  442. package/styles/pop.js +1 -1
  443. package/styles/porple.css +1 -1
  444. package/styles/porple.js +1 -1
  445. package/styles/purebasic.css +1 -1
  446. package/styles/purebasic.js +1 -1
  447. package/styles/qtcreator-dark.css +1 -1
  448. package/styles/qtcreator-dark.js +1 -1
  449. package/styles/qtcreator-light.css +1 -1
  450. package/styles/qtcreator-light.js +1 -1
  451. package/styles/qualia.css +1 -1
  452. package/styles/qualia.js +1 -1
  453. package/styles/railscasts.css +1 -1
  454. package/styles/railscasts.js +1 -1
  455. package/styles/rainbow.css +1 -1
  456. package/styles/rainbow.js +1 -1
  457. package/styles/rebecca.css +1 -1
  458. package/styles/rebecca.js +1 -1
  459. package/styles/ros-pine-dawn.css +1 -1
  460. package/styles/ros-pine-dawn.js +1 -1
  461. package/styles/ros-pine-moon.css +1 -1
  462. package/styles/ros-pine-moon.js +1 -1
  463. package/styles/ros-pine.css +1 -1
  464. package/styles/ros-pine.js +1 -1
  465. package/styles/rose-pine-dawn.css +1 -1
  466. package/styles/rose-pine-dawn.js +1 -1
  467. package/styles/rose-pine-moon.css +1 -1
  468. package/styles/rose-pine-moon.js +1 -1
  469. package/styles/rose-pine.css +1 -1
  470. package/styles/rose-pine.js +1 -1
  471. package/styles/routeros.css +1 -1
  472. package/styles/routeros.js +1 -1
  473. package/styles/sagelight.css +1 -1
  474. package/styles/sagelight.js +1 -1
  475. package/styles/sandcastle.css +1 -1
  476. package/styles/sandcastle.js +1 -1
  477. package/styles/school-book.css +1 -1
  478. package/styles/school-book.js +1 -1
  479. package/styles/seti-ui.css +1 -1
  480. package/styles/seti-ui.js +1 -1
  481. package/styles/shades-of-purple.css +2 -3
  482. package/styles/shades-of-purple.js +2 -3
  483. package/styles/shapeshifter.css +1 -1
  484. package/styles/shapeshifter.js +1 -1
  485. package/styles/silk-dark.css +1 -1
  486. package/styles/silk-dark.js +1 -1
  487. package/styles/silk-light.css +1 -1
  488. package/styles/silk-light.js +1 -1
  489. package/styles/snazzy.css +1 -1
  490. package/styles/snazzy.js +1 -1
  491. package/styles/solar-flare-light.css +1 -1
  492. package/styles/solar-flare-light.js +1 -1
  493. package/styles/solar-flare.css +1 -1
  494. package/styles/solar-flare.js +1 -1
  495. package/styles/solarized-dark.css +1 -1
  496. package/styles/solarized-dark.js +1 -1
  497. package/styles/solarized-light.css +1 -1
  498. package/styles/solarized-light.js +1 -1
  499. package/styles/spacemacs.css +1 -1
  500. package/styles/spacemacs.js +1 -1
  501. package/styles/srcery.css +1 -1
  502. package/styles/srcery.js +1 -1
  503. package/styles/stackoverflow-dark.css +1 -1
  504. package/styles/stackoverflow-dark.js +1 -1
  505. package/styles/stackoverflow-light.css +1 -1
  506. package/styles/stackoverflow-light.js +1 -1
  507. package/styles/summercamp.css +1 -1
  508. package/styles/summercamp.js +1 -1
  509. package/styles/summerfruit-dark.css +1 -1
  510. package/styles/summerfruit-dark.js +1 -1
  511. package/styles/summerfruit-light.css +1 -1
  512. package/styles/summerfruit-light.js +1 -1
  513. package/styles/sunburst.css +1 -1
  514. package/styles/sunburst.js +1 -1
  515. package/styles/synth-midnight-terminal-dark.css +1 -1
  516. package/styles/synth-midnight-terminal-dark.js +1 -1
  517. package/styles/synth-midnight-terminal-light.css +1 -1
  518. package/styles/synth-midnight-terminal-light.js +1 -1
  519. package/styles/tango.css +1 -1
  520. package/styles/tango.js +1 -1
  521. package/styles/tender.css +1 -1
  522. package/styles/tender.js +1 -1
  523. package/styles/tokyo-night-dark.css +1 -2
  524. package/styles/tokyo-night-dark.js +1 -2
  525. package/styles/tokyo-night-light.css +1 -2
  526. package/styles/tokyo-night-light.js +1 -2
  527. package/styles/tomorrow-night-blue.css +1 -1
  528. package/styles/tomorrow-night-blue.js +1 -1
  529. package/styles/tomorrow-night-bright.css +1 -1
  530. package/styles/tomorrow-night-bright.js +1 -1
  531. package/styles/tomorrow-night.css +1 -1
  532. package/styles/tomorrow-night.js +1 -1
  533. package/styles/tomorrow.css +1 -1
  534. package/styles/tomorrow.js +1 -1
  535. package/styles/twilight.css +1 -1
  536. package/styles/twilight.js +1 -1
  537. package/styles/unikitty-dark.css +1 -1
  538. package/styles/unikitty-dark.js +1 -1
  539. package/styles/unikitty-light.css +1 -1
  540. package/styles/unikitty-light.js +1 -1
  541. package/styles/vs.css +1 -1
  542. package/styles/vs.js +1 -1
  543. package/styles/vs2015.css +1 -1
  544. package/styles/vs2015.js +1 -1
  545. package/styles/vulcan.css +1 -1
  546. package/styles/vulcan.js +1 -1
  547. package/styles/windows-10-light.css +1 -1
  548. package/styles/windows-10-light.js +1 -1
  549. package/styles/windows-10.css +1 -1
  550. package/styles/windows-10.js +1 -1
  551. package/styles/windows-95-light.css +1 -1
  552. package/styles/windows-95-light.js +1 -1
  553. package/styles/windows-95.css +1 -1
  554. package/styles/windows-95.js +1 -1
  555. package/styles/windows-high-contrast-light.css +1 -1
  556. package/styles/windows-high-contrast-light.js +1 -1
  557. package/styles/windows-high-contrast.css +1 -1
  558. package/styles/windows-high-contrast.js +1 -1
  559. package/styles/windows-nt-light.css +1 -1
  560. package/styles/windows-nt-light.js +1 -1
  561. package/styles/windows-nt.css +1 -1
  562. package/styles/windows-nt.js +1 -1
  563. package/styles/woodland.css +1 -1
  564. package/styles/woodland.js +1 -1
  565. package/styles/xcode-dusk.css +1 -1
  566. package/styles/xcode-dusk.js +1 -1
  567. package/styles/xcode.css +1 -1
  568. package/styles/xcode.js +1 -1
  569. package/styles/xt256.css +1 -1
  570. package/styles/xt256.js +1 -1
  571. package/styles/zenburn.css +1 -1
  572. package/styles/zenburn.js +1 -1
@@ -0,0 +1,254 @@
1
+ import cssRegister from "highlight.js/lib/languages/css";
2
+ import goRegister from "highlight.js/lib/languages/go";
3
+ import javascriptRegister from "highlight.js/lib/languages/javascript";
4
+ import html from "./html.js";
5
+
6
+ const TEMPL_CONTROL_FLOW_KEYWORDS =
7
+ "if else for range switch case default break continue fallthrough return";
8
+
9
+ const TEMPL_TOP_LEVEL_KEYWORDS =
10
+ "package import func var const type struct interface";
11
+
12
+ /** @param {import("highlight.js").HLJSApi} hljs */
13
+ function defineTempl(hljs) {
14
+ // A minimal HTML tag matcher (mirrors razor.js's TAG mode) so markup
15
+ // nested inside a Go-flavored region (a `{ }` expression, or a
16
+ // control-flow block body) still renders as a tag instead of escaped
17
+ // plain text.
18
+ const TAG = {
19
+ className: "tag",
20
+ begin: /<\/?[a-zA-Z][\w-]*/,
21
+ end: />/,
22
+ relevance: 0,
23
+ };
24
+
25
+ // `{ expr }` inside templ markup renders a Go expression, e.g. `{ name }`,
26
+ // `{ user.Name }`, or the special `{ children... }` slot. It has its own
27
+ // `begin`, so it can safely self-recurse (via the *string* "self", which
28
+ // highlight.js clones per nesting level — a direct object self-reference
29
+ // would reuse a single compiled instance and silently stop matching
30
+ // siblings after the first nested close).
31
+ //
32
+ // This is a factory, not a shared constant: highlight.js compiles each
33
+ // mode *object* exactly once and caches its resolved parent on it, so
34
+ // reusing one GO_EXPRESSION instance at two different contains-array call
35
+ // sites (TEMPL_BODY and CONTROL_FLOW_BODY) leaves the second site's parent
36
+ // pointing at whichever site compiled first — corrupting the mode stack
37
+ // for everything scanned after that first use. A fresh object per call
38
+ // site avoids the collision.
39
+ const createGoExpression = () => ({
40
+ begin: /\{/,
41
+ end: /\}/,
42
+ subLanguage: "go",
43
+ contains: /** @type {(import("highlight.js").Mode | "self")[]} */ ([
44
+ "self",
45
+ TAG,
46
+ ]),
47
+ relevance: 0,
48
+ });
49
+
50
+ // `@component(...)`, `@templ.Join(...)`, and bare `@contents` calls
51
+ // compose other templ components from within markup. The argument list
52
+ // is matched up to the first `)` (not recursively brace/paren-balanced —
53
+ // combining "self" recursion with subLanguage + excludeBegin/excludeEnd
54
+ // here confuses highlight.js's end-matching and corrupts parsing of
55
+ // everything that follows). Component call arguments are rarely deeply
56
+ // nested, so this is an acceptable simplification.
57
+ //
58
+ // Also a factory, for the same shared-instance reason as GO_EXPRESSION
59
+ // above: it's used from both TEMPL_BODY and CONTROL_FLOW_BODY.
60
+ const createComponentCall = () => ({
61
+ className: "template-variable",
62
+ begin: /@[A-Za-z_][\w.]*/,
63
+ relevance: 0,
64
+ starts: {
65
+ begin: /\(/,
66
+ end: /\)/,
67
+ subLanguage: "go",
68
+ excludeBegin: true,
69
+ excludeEnd: true,
70
+ relevance: 0,
71
+ },
72
+ });
73
+
74
+ // The body of a Go control-flow block (`if cond { ... }`, `for ... { ... }`).
75
+ // Reached only via CONTROL_FLOW's `starts`, so its opening `{` is already
76
+ // consumed by CONTROL_FLOW's own `end` — this mode has no `begin` of its
77
+ // own. Nested control-flow blocks' braces still need to balance, but this
78
+ // mode can't self-recurse (a beginless mode has nothing to re-match), so a
79
+ // separate NESTED_BRACE mode — an anonymous `{ }` balancer with a real
80
+ // `begin`/`end` pair — handles that instead. A nested `if`'s keyword won't
81
+ // be separately classed as `keyword`, but its braces still balance.
82
+ //
83
+ // This is a factory, not a shared constant, for the same reason as
84
+ // createGoExpression/createComponentCall above: highlight.js compiles each
85
+ // mode *object* once and caches its resolved parent on it, so a single
86
+ // shared instance reused at a second call site would desync the mode
87
+ // stack for everything scanned after that first use. CONTROL_FLOW is only
88
+ // ever placed once (in TEMPL_BODY.contains), but it's still safest to
89
+ // treat its `starts` target as call-site-local.
90
+ const createControlFlowBody = () => ({
91
+ end: /\}/,
92
+ subLanguage: "html",
93
+ contains: [
94
+ hljs.COMMENT(/<!--/, /-->/, { relevance: 10 }),
95
+ createComponentCall(),
96
+ createGoExpression(),
97
+ { begin: /\{/, end: /\}/, contains: ["self"] },
98
+ ],
99
+ });
100
+
101
+ // Go control-flow keywords (if/else/for/switch/...) open a block, e.g.
102
+ // `if isLoggedIn {` or `for _, item := range items {`. The keyword and
103
+ // condition are highlighted as a standalone token; `end` consumes through
104
+ // the opening `{` itself (rather than a zero-width lookahead) so the
105
+ // control-flow body (handed off via `starts`) begins with a clean slate —
106
+ // a lookahead `end` paired with `starts` leaves highlight.js unable to
107
+ // resolve the parent scope once the started mode closes, silently
108
+ // corrupting highlighting for everything scanned afterward (verified by
109
+ // isolating the two `end` forms against a minimal repro grammar).
110
+ const CONTROL_FLOW = {
111
+ className: "keyword",
112
+ begin: new RegExp(
113
+ `\\b(?:${TEMPL_CONTROL_FLOW_KEYWORDS.split(" ").join("|")})\\b`,
114
+ ),
115
+ end: /\{/,
116
+ relevance: 10,
117
+ starts: createControlFlowBody(),
118
+ };
119
+
120
+ // The markup body of a `templ Name(...) { ... }` component. This mode is
121
+ // only ever reached via TEMPL_BLOCK's `starts` (a single usage site) and
122
+ // has no `begin` of its own — TEMPL_BLOCK's `end` already consumed the
123
+ // opening `{` — so it must NOT self-reference (a beginless mode has no
124
+ // way to consume characters, which makes "self" recursion loop forever).
125
+ // Nested braces are instead delegated entirely to CONTROL_FLOW,
126
+ // COMPONENT_CALL, and GO_EXPRESSION, each of which owns a real `begin`.
127
+ const TEMPL_BODY = {
128
+ end: /\}/,
129
+ subLanguage: "html",
130
+ contains: [
131
+ hljs.COMMENT(/<!--/, /-->/, { relevance: 10 }),
132
+ CONTROL_FLOW,
133
+ createComponentCall(),
134
+ createGoExpression(),
135
+ ],
136
+ };
137
+
138
+ // `templ Name(params) { ... }` declares a component. The `templ` keyword
139
+ // and Go-flavored signature are highlighted; the body is delegated to
140
+ // TEMPL_BODY.
141
+ const TEMPL_BLOCK = {
142
+ className: "keyword",
143
+ begin: /\btempl\b/,
144
+ end: /\{/,
145
+ relevance: 10,
146
+ contains: [
147
+ {
148
+ className: "title.function",
149
+ begin: /[A-Za-z_]\w*/,
150
+ relevance: 0,
151
+ },
152
+ {
153
+ begin: /\(/,
154
+ end: /\)/,
155
+ subLanguage: "go",
156
+ excludeBegin: true,
157
+ excludeEnd: true,
158
+ contains: /** @type {(import("highlight.js").Mode | "self")[]} */ ([
159
+ "self",
160
+ ]),
161
+ relevance: 0,
162
+ },
163
+ ],
164
+ starts: TEMPL_BODY,
165
+ };
166
+
167
+ // `css Name(params) { ... }` declares a CSS component; its entire body is
168
+ // CSS (with `{ goExpr }` interpolation for dynamic property values).
169
+ // `begin` matches only through the `css` keyword; `end` scans past the
170
+ // name/params to the opening `{` (mirroring TEMPL_BLOCK) so the `{` is
171
+ // consumed exactly once, by `end`, rather than duplicated between
172
+ // `begin` and `end`.
173
+ const CSS_BLOCK = {
174
+ className: "keyword",
175
+ begin: /\bcss\b/,
176
+ end: /\{/,
177
+ relevance: 10,
178
+ contains: [
179
+ {
180
+ begin: /\(/,
181
+ end: /\)/,
182
+ subLanguage: "go",
183
+ excludeBegin: true,
184
+ excludeEnd: true,
185
+ relevance: 0,
186
+ },
187
+ ],
188
+ starts: {
189
+ end: /\}/,
190
+ subLanguage: "css",
191
+ contains: [createGoExpression()],
192
+ relevance: 0,
193
+ },
194
+ };
195
+
196
+ // `script Name(params) { ... }` declares a legacy script component; its
197
+ // body is plain JavaScript.
198
+ const SCRIPT_BLOCK = {
199
+ className: "keyword",
200
+ begin: /\bscript\b/,
201
+ end: /\{/,
202
+ relevance: 10,
203
+ contains: [
204
+ {
205
+ begin: /\(/,
206
+ end: /\)/,
207
+ subLanguage: "go",
208
+ excludeBegin: true,
209
+ excludeEnd: true,
210
+ relevance: 0,
211
+ },
212
+ ],
213
+ starts: {
214
+ end: /\}/,
215
+ subLanguage: "javascript",
216
+ relevance: 0,
217
+ },
218
+ };
219
+
220
+ // Outside of templ/css/script blocks, a `.templ` file is ordinary Go code
221
+ // (package declaration, imports, plain functions, variables).
222
+ const GO_TOP_LEVEL_KEYWORDS = {
223
+ className: "keyword",
224
+ begin: new RegExp(
225
+ `\\b(?:${TEMPL_TOP_LEVEL_KEYWORDS.split(" ").join("|")})\\b`,
226
+ ),
227
+ relevance: 0,
228
+ };
229
+
230
+ return {
231
+ name: "templ",
232
+ aliases: ["templ"],
233
+ contains: [
234
+ hljs.C_LINE_COMMENT_MODE,
235
+ hljs.C_BLOCK_COMMENT_MODE,
236
+ CSS_BLOCK,
237
+ SCRIPT_BLOCK,
238
+ TEMPL_BLOCK,
239
+ GO_TOP_LEVEL_KEYWORDS,
240
+ ],
241
+ };
242
+ }
243
+
244
+ /** @type {import("highlight.js").LanguageFn} */
245
+ function register(hljs) {
246
+ hljs.registerLanguage("html", html.register);
247
+ hljs.registerLanguage("go", goRegister);
248
+ hljs.registerLanguage("css", cssRegister);
249
+ hljs.registerLanguage("javascript", javascriptRegister);
250
+ return defineTempl(hljs);
251
+ }
252
+
253
+ export const templ = { name: "templ", register };
254
+ export default templ;
package/languages/toml.js CHANGED
@@ -51,9 +51,11 @@ function defineToml(hljs) {
51
51
  relevance: 10,
52
52
  };
53
53
 
54
+ const KEY_SEGMENT = /(?:[A-Za-z0-9_-]+|"(?:[^"\\]|\\.)*"|'[^']*')/.source;
55
+
54
56
  const ATTR = {
55
57
  className: "attr",
56
- begin: /[A-Za-z0-9_-]+(?:\s*\.\s*[A-Za-z0-9_-]+)*(?=\s*=)/,
58
+ begin: new RegExp(`${KEY_SEGMENT}(?:\\s*\\.\\s*${KEY_SEGMENT})*(?=\\s*=)`),
57
59
  relevance: 0,
58
60
  };
59
61
 
@@ -0,0 +1,2 @@
1
+ export { typst } from "./";
2
+ export { typst as default } from "./";
@@ -0,0 +1,185 @@
1
+ const TYPST_KEYWORDS =
2
+ "let set show if else for while in as return break continue import include " +
3
+ "from and or not none auto context";
4
+
5
+ const TYPST_LITERALS = "true false none auto";
6
+
7
+ /** @param {import("highlight.js").HLJSApi} hljs */
8
+ function defineTypst(hljs) {
9
+ const NUMBER = {
10
+ className: "number",
11
+ begin:
12
+ /\b\d+(?:\.\d+)?(?:e[+-]?\d+)?(?:%|pt|mm|cm|in|em|fr|deg|rad)?(?![\w%])/,
13
+ relevance: 0,
14
+ };
15
+
16
+ const STRING = {
17
+ className: "string",
18
+ begin: /"/,
19
+ end: /"/,
20
+ contains: [hljs.BACKSLASH_ESCAPE],
21
+ };
22
+
23
+ const LINE_COMMENT = hljs.C_LINE_COMMENT_MODE;
24
+ const BLOCK_COMMENT = hljs.C_BLOCK_COMMENT_MODE;
25
+
26
+ const LABEL = {
27
+ className: "symbol",
28
+ begin: /<[a-zA-Z_][\w-]*>/,
29
+ };
30
+
31
+ const REFERENCE = {
32
+ className: "symbol",
33
+ begin: /@[a-zA-Z_][\w-]*/,
34
+ };
35
+
36
+ const FUNCTION_CALL = {
37
+ className: "title.function",
38
+ begin: /\b[a-zA-Z_][\w-]*(?=\()/,
39
+ relevance: 0,
40
+ };
41
+
42
+ // Inline raw span: `code` (single backtick, no newlines)
43
+ const RAW_INLINE = {
44
+ className: "code",
45
+ begin: /`/,
46
+ end: /`/,
47
+ contains: [hljs.BACKSLASH_ESCAPE],
48
+ };
49
+
50
+ // Fenced raw block: ```lang\n ... \n```
51
+ const RAW_BLOCK = {
52
+ className: "code",
53
+ begin: /```/,
54
+ end: /```/,
55
+ };
56
+
57
+ const MATH = {
58
+ className: "string",
59
+ begin: /\$/,
60
+ end: /\$/,
61
+ contains: [hljs.BACKSLASH_ESCAPE],
62
+ };
63
+
64
+ const HEADING = {
65
+ className: "title",
66
+ begin: /^[ \t]*={1,6}(?=[ \t]|$)/,
67
+ end: /$/,
68
+ excludeEnd: false,
69
+ relevance: 10,
70
+ };
71
+
72
+ const STRONG = {
73
+ className: "strong",
74
+ begin: /\*(?!\s)/,
75
+ end: /(?!\s)\*/,
76
+ };
77
+
78
+ const EMPHASIS = {
79
+ className: "emphasis",
80
+ begin: /_(?!\s)/,
81
+ end: /(?!\s)_/,
82
+ };
83
+
84
+ const LIST_MARKER = {
85
+ className: "bullet",
86
+ begin: /^[ \t]*(-|\+|\d+\.)(?=[ \t])/,
87
+ relevance: 0,
88
+ };
89
+
90
+ const codeContains = () => [
91
+ LINE_COMMENT,
92
+ BLOCK_COMMENT,
93
+ STRING,
94
+ NUMBER,
95
+ FUNCTION_CALL,
96
+ PARENS,
97
+ BRACES,
98
+ BRACKETS,
99
+ ];
100
+
101
+ // Parenthesized argument/expression lists: (...)
102
+ /** @type {import("highlight.js").Mode} */
103
+ const PARENS = {
104
+ begin: /\(/,
105
+ end: /\)/,
106
+ keywords: { keyword: TYPST_KEYWORDS, literal: TYPST_LITERALS },
107
+ contains: [],
108
+ };
109
+
110
+ // Code block / dict / set body: {...}
111
+ /** @type {import("highlight.js").Mode} */
112
+ const BRACES = {
113
+ begin: /\{/,
114
+ end: /\}/,
115
+ keywords: { keyword: TYPST_KEYWORDS, literal: TYPST_LITERALS },
116
+ contains: [],
117
+ };
118
+
119
+ // Content block: [...] (markup nested inside code mode)
120
+ /** @type {import("highlight.js").Mode} */
121
+ const BRACKETS = {
122
+ begin: /\[/,
123
+ end: /\]/,
124
+ keywords: { keyword: TYPST_KEYWORDS, literal: TYPST_LITERALS },
125
+ contains: [],
126
+ };
127
+
128
+ PARENS.contains = /** @type {(import("highlight.js").Mode | "self")[]} */ ([
129
+ "self",
130
+ ...codeContains(),
131
+ ]);
132
+ BRACES.contains = /** @type {(import("highlight.js").Mode | "self")[]} */ ([
133
+ "self",
134
+ ...codeContains(),
135
+ ]);
136
+ BRACKETS.contains = /** @type {(import("highlight.js").Mode | "self")[]} */ ([
137
+ "self",
138
+ STRONG,
139
+ EMPHASIS,
140
+ ...codeContains(),
141
+ ]);
142
+
143
+ // Code mode: activated after `#`, covers keywords, function calls,
144
+ // strings, numbers, comments, and nested blocks/parens/brackets. Ends
145
+ // at a blank line, a markup-only boundary character, or end of input.
146
+ const CODE_MODE = {
147
+ begin: /#(?=[a-zA-Z_])/,
148
+ end: /$|(?=[;,])/,
149
+ returnEnd: true,
150
+ relevance: 5,
151
+ keywords: {
152
+ keyword: TYPST_KEYWORDS,
153
+ literal: TYPST_LITERALS,
154
+ },
155
+ contains: codeContains(),
156
+ };
157
+
158
+ return {
159
+ name: "Typst",
160
+ aliases: ["typst", "typ"],
161
+ contains: [
162
+ LINE_COMMENT,
163
+ BLOCK_COMMENT,
164
+ HEADING,
165
+ LABEL,
166
+ REFERENCE,
167
+ RAW_BLOCK,
168
+ RAW_INLINE,
169
+ MATH,
170
+ STRONG,
171
+ EMPHASIS,
172
+ LIST_MARKER,
173
+ NUMBER,
174
+ CODE_MODE,
175
+ ],
176
+ };
177
+ }
178
+
179
+ /** @type {import("highlight.js").LanguageFn} */
180
+ function register(hljs) {
181
+ return defineTypst(hljs);
182
+ }
183
+
184
+ export const typst = { name: "typst", register };
185
+ export default typst;
package/languages/v.js CHANGED
@@ -30,12 +30,20 @@ function defineV(hljs) {
30
30
  className: "string",
31
31
  variants: [
32
32
  {
33
- begin: /[rc]?"/,
33
+ begin: /r"/,
34
+ end: /"/,
35
+ },
36
+ {
37
+ begin: /r'/,
38
+ end: /'/,
39
+ },
40
+ {
41
+ begin: /c?"/,
34
42
  end: /"/,
35
43
  contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION],
36
44
  },
37
45
  {
38
- begin: /[rc]?'/,
46
+ begin: /c?'/,
39
47
  end: /'/,
40
48
  contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION],
41
49
  },
@@ -61,6 +69,18 @@ function defineV(hljs) {
61
69
  relevance: 0,
62
70
  };
63
71
 
72
+ const COMPTIME_KEYWORD = {
73
+ className: "keyword",
74
+ begin: /\$(?:if|else|for)\b/,
75
+ relevance: 0,
76
+ };
77
+
78
+ const OPTION_TYPE = {
79
+ className: "type",
80
+ begin: /\?(?=[A-Za-z_])/,
81
+ relevance: 0,
82
+ };
83
+
64
84
  return {
65
85
  name: "V",
66
86
  aliases: ["v", "vlang"],
@@ -72,10 +92,12 @@ function defineV(hljs) {
72
92
  contains: [
73
93
  hljs.C_LINE_COMMENT_MODE,
74
94
  hljs.C_BLOCK_COMMENT_MODE,
95
+ COMPTIME_KEYWORD,
75
96
  ATTRIBUTE,
76
97
  STRING,
77
98
  FUNCTION,
78
99
  TYPE,
100
+ OPTION_TYPE,
79
101
  NUMBER,
80
102
  ],
81
103
  };
package/languages/vue.js CHANGED
@@ -23,9 +23,11 @@ const STYLE_CSS_BEGIN =
23
23
 
24
24
  /** @param {import("highlight.js").HLJSApi} hljs */
25
25
  function defineVue(hljs) {
26
+ // Match any `v-*` directive, not just the built-in list, so custom
27
+ // user-registered directives (e.g. `v-focus`, `v-tooltip`) are recognized
28
+ // too.
26
29
  const vueDirective = {
27
- begin:
28
- /\bv-(?:if|else-if|else|for|show|model|bind|on|slot|pre|once|memo|html|text|cloak)(?:\.[\w-]+)*(?==|\s|>)/,
30
+ begin: /\bv-[\w-]+(?:\.[\w-]+)*(?==|\s|>)/,
29
31
  className: "keyword",
30
32
  relevance: 10,
31
33
  };
@@ -28,6 +28,11 @@ function defineVyper(hljs) {
28
28
  beginScope: { 1: "keyword", 3: "title.function" },
29
29
  };
30
30
 
31
+ const NAMED_DECLARATION = {
32
+ begin: [/\b(?:struct|interface|event)/, /\s+/, /[a-zA-Z_]\w*/],
33
+ beginScope: { 1: "keyword", 3: "title class_" },
34
+ };
35
+
31
36
  return {
32
37
  name: "Vyper",
33
38
  aliases: ["vyper"],
@@ -39,9 +44,22 @@ function defineVyper(hljs) {
39
44
  contains: [
40
45
  hljs.HASH_COMMENT_MODE,
41
46
  { className: "string", begin: /"""/, end: /"""/ },
47
+ {
48
+ className: "string",
49
+ begin: /b"/,
50
+ end: /"/,
51
+ contains: [hljs.BACKSLASH_ESCAPE],
52
+ },
53
+ {
54
+ className: "string",
55
+ begin: /b'/,
56
+ end: /'/,
57
+ contains: [hljs.BACKSLASH_ESCAPE],
58
+ },
42
59
  hljs.QUOTE_STRING_MODE,
43
60
  hljs.APOS_STRING_MODE,
44
61
  DECORATOR,
62
+ NAMED_DECLARATION,
45
63
  FUNCTION,
46
64
  NUMBER,
47
65
  ],
package/languages/wgsl.js CHANGED
@@ -6,6 +6,9 @@ const WGSL_TYPES =
6
6
 
7
7
  const WGSL_LITERALS = "true false";
8
8
 
9
+ const WGSL_BUILTINS =
10
+ "vertex_index instance_index position frag_depth sample_index sample_mask local_invocation_id global_invocation_id workgroup_id num_workgroups front_facing";
11
+
9
12
  /** @param {import("highlight.js").HLJSApi} hljs */
10
13
  function defineWgsl(hljs) {
11
14
  const NUMBER = {
@@ -29,6 +32,15 @@ function defineWgsl(hljs) {
29
32
  beginScope: { 1: "keyword", 3: "title.function" },
30
33
  };
31
34
 
35
+ const VAR_ADDRESS_SPACE = {
36
+ begin: [/\bvar/, /\s*</],
37
+ beginScope: { 1: "keyword" },
38
+ end: />/,
39
+ keywords: {
40
+ keyword: "storage uniform workgroup private read write read_write",
41
+ },
42
+ };
43
+
32
44
  return {
33
45
  name: "WGSL",
34
46
  aliases: ["wgsl"],
@@ -36,11 +48,13 @@ function defineWgsl(hljs) {
36
48
  keyword: WGSL_KEYWORDS,
37
49
  type: WGSL_TYPES,
38
50
  literal: WGSL_LITERALS,
51
+ built_in: WGSL_BUILTINS,
39
52
  },
40
53
  contains: [
41
54
  hljs.C_LINE_COMMENT_MODE,
42
55
  hljs.C_BLOCK_COMMENT_MODE,
43
56
  ATTRIBUTE,
57
+ VAR_ADDRESS_SPACE,
44
58
  FUNCTION,
45
59
  NUMBER,
46
60
  ],
package/languages/zig.js CHANGED
@@ -21,6 +21,12 @@ function defineZig(hljs) {
21
21
  relevance: 0,
22
22
  };
23
23
 
24
+ const TYPE_MODIFIER = {
25
+ className: "type",
26
+ begin: /[?!](?=[A-Za-z_*])/,
27
+ relevance: 0,
28
+ };
29
+
24
30
  const NAMED_TYPE = {
25
31
  className: "type",
26
32
  begin: new RegExp(String.raw`\b(?:${ZIG_TYPES.split(" ").join("|")})\b`),
@@ -78,6 +84,7 @@ function defineZig(hljs) {
78
84
  CHAR,
79
85
  BUILTIN,
80
86
  NUMBER,
87
+ TYPE_MODIFIER,
81
88
  INT_TYPE,
82
89
  NAMED_TYPE,
83
90
  {
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "svelte-highlight",
3
- "version": "7.13.0",
3
+ "version": "7.14.0",
4
4
  "license": "MIT",
5
5
  "description": "Svelte component library for highlighting code using highlight.js",
6
6
  "author": "Eric Liu (https://github.com/metonym)",
7
7
  "type": "module",
8
8
  "dependencies": {
9
- "highlight.js": "11.11.1"
9
+ "highlight.js": "11.11.1",
10
+ "magic-string": "^0.30.17"
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",
@@ -25,6 +26,14 @@
25
26
  "types": "./index.d.ts",
26
27
  "svelte": "./index.js"
27
28
  },
29
+ "./static": {
30
+ "types": "./static.d.ts",
31
+ "import": "./static.js"
32
+ },
33
+ "./static.js": {
34
+ "types": "./static.d.ts",
35
+ "import": "./static.js"
36
+ },
28
37
  "./*.svelte": {
29
38
  "types": "./*.svelte.d.ts",
30
39
  "import": "./*.svelte"