svelte-highlight 7.20.0 → 7.21.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 (1007) hide show
  1. package/AnsiOutput.svelte +35 -4
  2. package/AnsiOutput.svelte.d.ts +7 -0
  3. package/FileTabs.svelte +77 -4
  4. package/FileTabs.svelte.d.ts +11 -0
  5. package/Highlight.svelte +12 -2
  6. package/Highlight.svelte.d.ts +32 -0
  7. package/HighlightAuto.svelte +17 -3
  8. package/HighlightAuto.svelte.d.ts +13 -0
  9. package/HighlightEditable.svelte +33 -4
  10. package/HighlightEditable.svelte.d.ts +14 -4
  11. package/HighlightStream.svelte +118 -13
  12. package/HighlightStream.svelte.d.ts +20 -0
  13. package/HighlightStyle.svelte +33 -13
  14. package/HighlightStyle.svelte.d.ts +10 -1
  15. package/HighlightSvelte.svelte +12 -2
  16. package/HighlightSvelte.svelte.d.ts +5 -0
  17. package/HighlightVirtual.svelte +41 -2
  18. package/HighlightVirtual.svelte.d.ts +12 -2
  19. package/LangTag.svelte +4 -0
  20. package/LangTag.svelte.d.ts +3 -0
  21. package/LineNumbers.svelte +88 -37
  22. package/LineNumbers.svelte.d.ts +60 -4
  23. package/README.md +556 -77
  24. package/Typewriter.svelte +61 -12
  25. package/Typewriter.svelte.d.ts +31 -1
  26. package/ansi.d.ts +42 -2
  27. package/ansi.js +286 -1
  28. package/compat.d.ts +8 -1
  29. package/compat.js +9 -5
  30. package/css-walk.js +97 -0
  31. package/engine.d.ts +18 -2
  32. package/engine.js +101 -13
  33. package/fence.d.ts +40 -0
  34. package/fence.js +124 -0
  35. package/highlight-theme.js +6 -86
  36. package/incremental-tokenize.js +55 -54
  37. package/index.d.ts +1 -1
  38. package/index.js +1 -1
  39. package/langtag.css +5 -0
  40. package/languages/1c.js +1 -1356
  41. package/languages/abnf.js +1 -85
  42. package/languages/accesslog.js +1 -84
  43. package/languages/actionscript.js +1 -217
  44. package/languages/ada.js +1 -232
  45. package/languages/agda.js +1 -98
  46. package/languages/all.js +62 -281
  47. package/languages/angelscript.js +1 -173
  48. package/languages/angular.js +1 -87
  49. package/languages/apache.js +1 -95
  50. package/languages/applescript.js +1 -287
  51. package/languages/arcade.js +1 -1036
  52. package/languages/arduino.js +1 -6221
  53. package/languages/armasm.js +1 -547
  54. package/languages/asciidoc.js +1 -233
  55. package/languages/aspectj.js +1 -766
  56. package/languages/assemblyscript.js +1 -60
  57. package/languages/astro.js +1 -68
  58. package/languages/autohotkey.js +1 -129
  59. package/languages/autoit.js +1 -594
  60. package/languages/avrasm.js +1 -368
  61. package/languages/awk.js +1 -111
  62. package/languages/axapta.js +1 -447
  63. package/languages/baml.d.ts +2 -0
  64. package/languages/baml.js +3 -0
  65. package/languages/bash.js +1 -331
  66. package/languages/basic.js +1 -258
  67. package/languages/bend.d.ts +2 -0
  68. package/languages/bend.js +2 -0
  69. package/languages/bibtex.js +1 -48
  70. package/languages/bicep.js +1 -143
  71. package/languages/bitbake.d.ts +2 -0
  72. package/languages/bitbake.js +4 -0
  73. package/languages/blade.js +1 -95
  74. package/languages/blueprint.d.ts +2 -0
  75. package/languages/blueprint.js +2 -0
  76. package/languages/bnf.js +1 -49
  77. package/languages/bpftrace.d.ts +2 -0
  78. package/languages/bpftrace.js +2 -0
  79. package/languages/bqn.d.ts +2 -0
  80. package/languages/bqn.js +2 -0
  81. package/languages/brainfuck.js +1 -65
  82. package/languages/c.js +1 -2304
  83. package/languages/c3.d.ts +2 -0
  84. package/languages/c3.js +2 -0
  85. package/languages/caddy.js +1 -133
  86. package/languages/cairo.js +1 -167
  87. package/languages/cal.js +1 -193
  88. package/languages/capnproto.js +1 -101
  89. package/languages/cedar.js +1 -56
  90. package/languages/cel.js +1 -102
  91. package/languages/ceylon.js +1 -184
  92. package/languages/cisco.d.ts +2 -0
  93. package/languages/cisco.js +2 -0
  94. package/languages/civet.d.ts +2 -0
  95. package/languages/civet.js +5 -0
  96. package/languages/clarity.js +1 -159
  97. package/languages/clean.js +1 -103
  98. package/languages/clojure-repl.js +1 -21
  99. package/languages/clojure.js +1 -549
  100. package/languages/cmake.js +1 -221
  101. package/languages/codeql.d.ts +2 -0
  102. package/languages/codeql.js +2 -0
  103. package/languages/coffeescript.js +1 -823
  104. package/languages/coq.js +1 -443
  105. package/languages/cos.js +1 -179
  106. package/languages/cpp.js +1 -2309
  107. package/languages/cql.js +1 -202
  108. package/languages/crmsh.js +1 -197
  109. package/languages/crontab.d.ts +2 -0
  110. package/languages/crontab.js +3 -0
  111. package/languages/crystal.js +1 -729
  112. package/languages/csharp.js +1 -1109
  113. package/languages/csp.js +1 -52
  114. package/languages/css.js +1 -219
  115. package/languages/csv.d.ts +2 -0
  116. package/languages/csv.js +2 -0
  117. package/languages/cue.js +1 -147
  118. package/languages/cypher.js +1 -147
  119. package/languages/d.js +1 -240
  120. package/languages/d2.js +1 -120
  121. package/languages/dart.js +1 -320
  122. package/languages/datalog.js +1 -96
  123. package/languages/dax.js +1 -271
  124. package/languages/delphi.js +1 -464
  125. package/languages/dhall.js +1 -162
  126. package/languages/diff.js +1 -33
  127. package/languages/django.js +1 -212
  128. package/languages/djot.d.ts +2 -0
  129. package/languages/djot.js +2 -0
  130. package/languages/dns.js +1 -127
  131. package/languages/dockerfile.js +1 -78
  132. package/languages/dos.js +1 -169
  133. package/languages/dotenv.js +1 -73
  134. package/languages/dsconfig.js +1 -72
  135. package/languages/dtrace.d.ts +2 -0
  136. package/languages/dtrace.js +2 -0
  137. package/languages/dts.js +1 -195
  138. package/languages/dust.js +1 -53
  139. package/languages/earthfile.js +1 -46
  140. package/languages/ebnf.js +1 -41
  141. package/languages/ejs.d.ts +2 -0
  142. package/languages/ejs.js +4 -0
  143. package/languages/elixir.js +1 -522
  144. package/languages/elm.js +1 -168
  145. package/languages/erb.js +1 -35
  146. package/languages/erlang-repl.js +1 -104
  147. package/languages/erlang.js +1 -351
  148. package/languages/esql.js +1 -116
  149. package/languages/excel.js +1 -589
  150. package/languages/fennel.js +1 -98
  151. package/languages/fish.js +1 -119
  152. package/languages/fix.js +1 -34
  153. package/languages/flix.js +1 -103
  154. package/languages/flux.js +1 -271
  155. package/languages/fortran.js +1 -626
  156. package/languages/freedesktop.js +1 -40
  157. package/languages/fsharp.js +1 -846
  158. package/languages/gams.js +1 -701
  159. package/languages/gauss.js +1 -3841
  160. package/languages/gbnf.d.ts +2 -0
  161. package/languages/gbnf.js +2 -0
  162. package/languages/gcode.js +1 -177
  163. package/languages/gdscript.js +1 -157
  164. package/languages/gdshader.d.ts +2 -0
  165. package/languages/gdshader.js +2 -0
  166. package/languages/gherkin.js +1 -62
  167. package/languages/gleam.js +1 -116
  168. package/languages/glsl.js +1 -634
  169. package/languages/gml.js +1 -3147
  170. package/languages/go.js +1 -256
  171. package/languages/golo.js +1 -93
  172. package/languages/gotmpl.d.ts +2 -0
  173. package/languages/gotmpl.js +2 -0
  174. package/languages/gradle.js +1 -229
  175. package/languages/graphql.js +1 -97
  176. package/languages/graphviz.d.ts +2 -0
  177. package/languages/graphviz.js +3 -0
  178. package/languages/groovy.js +1 -260
  179. package/languages/groq.js +1 -95
  180. package/languages/haml.js +1 -107
  181. package/languages/handlebars.js +1 -364
  182. package/languages/haproxy.d.ts +2 -0
  183. package/languages/haproxy.js +2 -0
  184. package/languages/haskell.js +1 -269
  185. package/languages/haxe.js +1 -286
  186. package/languages/hcl.js +1 -149
  187. package/languages/heex.js +1 -127
  188. package/languages/helm.d.ts +2 -0
  189. package/languages/helm.js +3 -0
  190. package/languages/hlsl.js +1 -305
  191. package/languages/hocon.d.ts +2 -0
  192. package/languages/hocon.js +2 -0
  193. package/languages/hsp.js +1 -486
  194. package/languages/html.js +1 -210
  195. package/languages/http.js +1 -80
  196. package/languages/hurl.js +1 -119
  197. package/languages/hy.js +1 -419
  198. package/languages/idris.js +1 -96
  199. package/languages/imba.d.ts +2 -0
  200. package/languages/imba.js +4 -0
  201. package/languages/index.d.ts +134 -9
  202. package/languages/index.js +340 -279
  203. package/languages/inform7.js +1 -59
  204. package/languages/ini.js +1 -85
  205. package/languages/ink.d.ts +2 -0
  206. package/languages/ink.js +2 -0
  207. package/languages/irpf90.js +1 -608
  208. package/languages/isbl.js +1 -10131
  209. package/languages/java.js +1 -549
  210. package/languages/javascript.js +1 -1242
  211. package/languages/jboss-cli.js +1 -110
  212. package/languages/jinja.js +1 -106
  213. package/languages/jmespath.js +1 -94
  214. package/languages/jq.js +1 -330
  215. package/languages/json.js +1 -95
  216. package/languages/json5.js +1 -108
  217. package/languages/jsonata.js +1 -78
  218. package/languages/jsonc.js +1 -76
  219. package/languages/jsonnet.js +1 -140
  220. package/languages/julia-repl.js +1 -29
  221. package/languages/julia.js +1 -617
  222. package/languages/just.js +1 -228
  223. package/languages/kcl.d.ts +2 -0
  224. package/languages/kcl.js +2 -0
  225. package/languages/kconfig.d.ts +2 -0
  226. package/languages/kconfig.js +2 -0
  227. package/languages/kdl.js +1 -113
  228. package/languages/koka.d.ts +2 -0
  229. package/languages/koka.js +2 -0
  230. package/languages/kotlin.js +1 -591
  231. package/languages/kql.js +1 -284
  232. package/languages/kv.d.ts +2 -0
  233. package/languages/kv.js +3 -0
  234. package/languages/lasso.js +1 -564
  235. package/languages/latex.js +1 -666
  236. package/languages/ldif.js +1 -37
  237. package/languages/ldscript.d.ts +2 -0
  238. package/languages/ldscript.js +2 -0
  239. package/languages/leaf.js +1 -61
  240. package/languages/lean.js +1 -116
  241. package/languages/less.js +1 -798
  242. package/languages/liquid.js +1 -113
  243. package/languages/lisp.js +1 -151
  244. package/languages/livecodeserver.js +1 -824
  245. package/languages/livescript.js +1 -1078
  246. package/languages/llvm.js +1 -380
  247. package/languages/log.d.ts +2 -0
  248. package/languages/log.js +2 -0
  249. package/languages/logql.js +1 -121
  250. package/languages/lookml.d.ts +2 -0
  251. package/languages/lookml.js +3 -0
  252. package/languages/lsl.js +1 -126
  253. package/languages/lua.js +1 -275
  254. package/languages/luau.js +1 -127
  255. package/languages/makefile.js +1 -120
  256. package/languages/markdoc.d.ts +2 -0
  257. package/languages/markdoc.js +4 -0
  258. package/languages/markdown.js +1 -222
  259. package/languages/marko.js +1 -147
  260. package/languages/mathematica.js +1 -7329
  261. package/languages/matlab.js +1 -331
  262. package/languages/maxima.js +1 -2491
  263. package/languages/mdx.js +1 -158
  264. package/languages/mel.js +1 -1305
  265. package/languages/mercury.js +1 -227
  266. package/languages/mermaid.js +1 -124
  267. package/languages/mipsasm.js +1 -285
  268. package/languages/mizar.js +1 -111
  269. package/languages/modelfile.d.ts +2 -0
  270. package/languages/modelfile.js +2 -0
  271. package/languages/mojo.js +1 -135
  272. package/languages/mojolicious.js +1 -28
  273. package/languages/monkey.js +1 -201
  274. package/languages/moonscript.js +1 -330
  275. package/languages/move.js +1 -151
  276. package/languages/n1ql.js +1 -371
  277. package/languages/nestedtext.js +1 -72
  278. package/languages/nginx.js +1 -197
  279. package/languages/nickel.js +1 -128
  280. package/languages/nim.js +1 -202
  281. package/languages/nix.js +1 -306
  282. package/languages/node-repl.js +1 -29
  283. package/languages/nsis.js +1 -452
  284. package/languages/nushell.js +1 -162
  285. package/languages/objectivec.js +1 -299
  286. package/languages/ocaml.js +1 -161
  287. package/languages/odin.js +1 -178
  288. package/languages/openscad.js +1 -181
  289. package/languages/org.d.ts +2 -0
  290. package/languages/org.js +2 -0
  291. package/languages/oxygene.js +1 -455
  292. package/languages/parser3.js +1 -107
  293. package/languages/perl.js +1 -860
  294. package/languages/pf.js +1 -164
  295. package/languages/pgsql.js +1 -1249
  296. package/languages/php-template.js +1 -24
  297. package/languages/php.js +1 -1153
  298. package/languages/pkl.js +1 -196
  299. package/languages/plaintext.js +1 -13
  300. package/languages/plantuml.d.ts +2 -0
  301. package/languages/plantuml.js +2 -0
  302. package/languages/plsql.d.ts +2 -0
  303. package/languages/plsql.js +2 -0
  304. package/languages/polar.js +1 -58
  305. package/languages/pony.js +1 -128
  306. package/languages/powerquery.d.ts +2 -0
  307. package/languages/powerquery.js +2 -0
  308. package/languages/powershell.js +1 -401
  309. package/languages/prisma.js +1 -97
  310. package/languages/processing.js +1 -441
  311. package/languages/profile.js +1 -62
  312. package/languages/prolog.js +1 -138
  313. package/languages/promql.js +1 -206
  314. package/languages/properties.js +1 -71
  315. package/languages/protobuf.js +1 -102
  316. package/languages/prql.js +1 -159
  317. package/languages/pug.js +1 -122
  318. package/languages/puppet.js +1 -411
  319. package/languages/purebasic.js +1 -183
  320. package/languages/purescript.js +1 -101
  321. package/languages/python-repl.js +1 -31
  322. package/languages/python.js +1 -800
  323. package/languages/q.js +1 -211
  324. package/languages/qml.js +1 -397
  325. package/languages/r.js +1 -347
  326. package/languages/racket.js +1 -146
  327. package/languages/raku.d.ts +2 -0
  328. package/languages/raku.js +2 -0
  329. package/languages/razor.js +1 -418
  330. package/languages/reasonml.js +1 -203
  331. package/languages/regex.d.ts +2 -0
  332. package/languages/regex.js +2 -0
  333. package/languages/rego.js +1 -181
  334. package/languages/renpy.d.ts +2 -0
  335. package/languages/renpy.js +3 -0
  336. package/languages/rescript.js +1 -202
  337. package/languages/rib.js +1 -144
  338. package/languages/roboconf.js +1 -124
  339. package/languages/roc.d.ts +2 -0
  340. package/languages/roc.js +2 -0
  341. package/languages/ron.d.ts +2 -0
  342. package/languages/ron.js +2 -0
  343. package/languages/routeros.js +1 -165
  344. package/languages/rpmspec.d.ts +2 -0
  345. package/languages/rpmspec.js +2 -0
  346. package/languages/rsl.js +1 -171
  347. package/languages/rst.js +1 -112
  348. package/languages/ruby.js +1 -886
  349. package/languages/ruleslanguage.js +1 -373
  350. package/languages/rust.js +1 -400
  351. package/languages/sas.js +1 -207
  352. package/languages/scala.js +1 -328
  353. package/languages/scheme.js +1 -394
  354. package/languages/scilab.js +1 -186
  355. package/languages/scss.js +1 -239
  356. package/languages/shaderlab.d.ts +2 -0
  357. package/languages/shaderlab.js +3 -0
  358. package/languages/shell.js +1 -28
  359. package/languages/slint.d.ts +2 -0
  360. package/languages/slint.js +2 -0
  361. package/languages/smali.js +1 -87
  362. package/languages/smalltalk.js +1 -85
  363. package/languages/smithy.d.ts +2 -0
  364. package/languages/smithy.js +2 -0
  365. package/languages/sml.js +1 -141
  366. package/languages/snort.d.ts +2 -0
  367. package/languages/snort.js +2 -0
  368. package/languages/solidity.js +1 -402
  369. package/languages/sparql.js +1 -152
  370. package/languages/splunk.js +1 -132
  371. package/languages/sqf.js +1 -2802
  372. package/languages/sql.js +1 -470
  373. package/languages/stan.js +1 -522
  374. package/languages/starlark.js +1 -124
  375. package/languages/stata.js +1 -1899
  376. package/languages/step21.js +1 -96
  377. package/languages/structurizr.d.ts +2 -0
  378. package/languages/structurizr.js +2 -0
  379. package/languages/stylus.js +1 -264
  380. package/languages/subunit.js +1 -55
  381. package/languages/surrealql.js +1 -127
  382. package/languages/svelte.js +1 -146
  383. package/languages/swift.js +1 -2241
  384. package/languages/systemd.d.ts +2 -0
  385. package/languages/systemd.js +2 -0
  386. package/languages/taggerscript.js +1 -47
  387. package/languages/tap.js +1 -44
  388. package/languages/tcl.js +1 -214
  389. package/languages/templ.js +1 -253
  390. package/languages/textproto.d.ts +2 -0
  391. package/languages/textproto.js +2 -0
  392. package/languages/thrift.js +1 -125
  393. package/languages/toml.js +1 -108
  394. package/languages/tp.js +1 -205
  395. package/languages/traceql.js +1 -107
  396. package/languages/tsq.d.ts +2 -0
  397. package/languages/tsq.js +2 -0
  398. package/languages/tsql.d.ts +2 -0
  399. package/languages/tsql.js +2 -0
  400. package/languages/tsrx.js +1 -111
  401. package/languages/turtle.d.ts +2 -0
  402. package/languages/turtle.js +2 -0
  403. package/languages/twig.js +1 -200
  404. package/languages/typescript.js +1 -1412
  405. package/languages/typespec.d.ts +2 -0
  406. package/languages/typespec.js +2 -0
  407. package/languages/typst.js +1 -341
  408. package/languages/uiua.d.ts +2 -0
  409. package/languages/uiua.js +2 -0
  410. package/languages/unison.d.ts +2 -0
  411. package/languages/unison.js +2 -0
  412. package/languages/v.js +1 -240
  413. package/languages/vala.js +1 -157
  414. package/languages/vbnet.js +1 -329
  415. package/languages/vbscript-html.js +1 -14
  416. package/languages/vbscript.js +1 -221
  417. package/languages/vcl.d.ts +2 -0
  418. package/languages/vcl.js +2 -0
  419. package/languages/verilog.js +1 -572
  420. package/languages/verse.d.ts +2 -0
  421. package/languages/verse.js +2 -0
  422. package/languages/vhdl.js +1 -225
  423. package/languages/vim.js +1 -1290
  424. package/languages/vrl.js +1 -129
  425. package/languages/vue.js +1 -121
  426. package/languages/vyper.js +1 -146
  427. package/languages/wasm.js +1 -136
  428. package/languages/wgsl.js +1 -372
  429. package/languages/wit.js +1 -131
  430. package/languages/wren.js +1 -307
  431. package/languages/x86asm.js +1 -2326
  432. package/languages/xl.js +1 -470
  433. package/languages/xml.js +1 -194
  434. package/languages/xquery.js +1 -311
  435. package/languages/yaml.js +1 -263
  436. package/languages/yang.d.ts +2 -0
  437. package/languages/yang.js +2 -0
  438. package/languages/yara.d.ts +2 -0
  439. package/languages/yara.js +2 -0
  440. package/languages/yarnspinner.d.ts +2 -0
  441. package/languages/yarnspinner.js +2 -0
  442. package/languages/zephir.js +1 -329
  443. package/languages/zig.js +1 -199
  444. package/load-language.d.ts +18 -0
  445. package/load-language.js +26 -1
  446. package/package.json +17 -1
  447. package/preprocessor.js +83 -17
  448. package/scoped.d.ts +10 -3
  449. package/scoped.js +32 -90
  450. package/split-lines.js +16 -15
  451. package/static.d.ts +14 -0
  452. package/stream-preview.d.ts +19 -0
  453. package/stream-preview.js +140 -0
  454. package/styles/1c-light.js +1 -1
  455. package/styles/3024.js +1 -1
  456. package/styles/a11y-dark.js +1 -1
  457. package/styles/a11y-light.js +1 -1
  458. package/styles/agate.js +1 -1
  459. package/styles/alebrije-dark.js +1 -1
  460. package/styles/alebrije-light.js +1 -1
  461. package/styles/alpenglow-dark.js +1 -1
  462. package/styles/alpenglow-light.js +1 -1
  463. package/styles/amaranth-dark.js +1 -1
  464. package/styles/amaranth-light.js +1 -1
  465. package/styles/an-old-hope.js +1 -1
  466. package/styles/anaglyph-dark.js +1 -1
  467. package/styles/anaglyph-light.js +1 -1
  468. package/styles/androidstudio.js +1 -1
  469. package/styles/apathy.js +1 -1
  470. package/styles/apprentice.js +1 -1
  471. package/styles/arduino-light.js +1 -1
  472. package/styles/arta.js +1 -1
  473. package/styles/ascetic.js +1 -1
  474. package/styles/ashes.js +1 -1
  475. package/styles/atelier-cave-light.js +1 -1
  476. package/styles/atelier-cave.js +1 -1
  477. package/styles/atelier-dune-light.js +1 -1
  478. package/styles/atelier-dune.js +1 -1
  479. package/styles/atelier-estuary-light.js +1 -1
  480. package/styles/atelier-estuary.js +1 -1
  481. package/styles/atelier-forest-light.js +1 -1
  482. package/styles/atelier-forest.js +1 -1
  483. package/styles/atelier-heath-light.js +1 -1
  484. package/styles/atelier-heath.js +1 -1
  485. package/styles/atelier-lakeside-light.js +1 -1
  486. package/styles/atelier-lakeside.js +1 -1
  487. package/styles/atelier-plateau-light.js +1 -1
  488. package/styles/atelier-plateau.js +1 -1
  489. package/styles/atelier-savanna-light.js +1 -1
  490. package/styles/atelier-savanna.js +1 -1
  491. package/styles/atelier-seaside-light.js +1 -1
  492. package/styles/atelier-seaside.js +1 -1
  493. package/styles/atelier-sulphurpool-light.js +1 -1
  494. package/styles/atelier-sulphurpool.js +1 -1
  495. package/styles/atlas.js +1 -1
  496. package/styles/atom-one-dark-reasonable.js +1 -1
  497. package/styles/atom-one-dark.js +1 -1
  498. package/styles/atom-one-light.js +1 -1
  499. package/styles/bakelite-dark.js +1 -1
  500. package/styles/bakelite-light.js +1 -1
  501. package/styles/base16-github.js +1 -1
  502. package/styles/base16-ir-black.js +1 -1
  503. package/styles/base16-monokai.js +1 -1
  504. package/styles/base16-nord.js +1 -1
  505. package/styles/bespin.js +1 -1
  506. package/styles/black-metal-bathory.js +1 -1
  507. package/styles/black-metal-burzum.js +1 -1
  508. package/styles/black-metal-dark-funeral.js +1 -1
  509. package/styles/black-metal-gorgoroth.js +1 -1
  510. package/styles/black-metal-immortal.js +1 -1
  511. package/styles/black-metal-khold.js +1 -1
  512. package/styles/black-metal-marduk.js +1 -1
  513. package/styles/black-metal-mayhem.js +1 -1
  514. package/styles/black-metal-nile.js +1 -1
  515. package/styles/black-metal-venom.js +1 -1
  516. package/styles/black-metal.js +1 -1
  517. package/styles/blacklight-dark.js +1 -1
  518. package/styles/blacklight-light.js +1 -1
  519. package/styles/brewer.js +1 -1
  520. package/styles/bright.js +1 -1
  521. package/styles/brogrammer.js +1 -1
  522. package/styles/brown-paper.js +1 -1
  523. package/styles/brush-trees-dark.js +1 -1
  524. package/styles/brush-trees.js +1 -1
  525. package/styles/celadon-dark.js +1 -1
  526. package/styles/celadon-light.js +1 -1
  527. package/styles/chalk.js +1 -1
  528. package/styles/circus.js +1 -1
  529. package/styles/classic-dark.js +1 -1
  530. package/styles/classic-light.js +1 -1
  531. package/styles/cobalt-dark.js +1 -1
  532. package/styles/cobalt-light.js +1 -1
  533. package/styles/cochineal-dark.js +1 -1
  534. package/styles/cochineal-light.js +1 -1
  535. package/styles/codepen-embed.js +1 -1
  536. package/styles/codeschool.js +1 -1
  537. package/styles/color-brewer.js +1 -1
  538. package/styles/colors.js +1 -1
  539. package/styles/cross-process-dark.js +1 -1
  540. package/styles/cross-process-light.js +1 -1
  541. package/styles/cupcake.js +1 -1
  542. package/styles/cupertino.js +1 -1
  543. package/styles/cyanotype-dark.js +1 -1
  544. package/styles/cyanotype-light.js +1 -1
  545. package/styles/cybertopia-cherry.js +1 -1
  546. package/styles/cybertopia-dimmer.js +1 -1
  547. package/styles/cybertopia-icecap.js +1 -1
  548. package/styles/cybertopia-saturated.js +1 -1
  549. package/styles/danqing.js +1 -1
  550. package/styles/darcula.js +1 -1
  551. package/styles/dark-violet.js +1 -1
  552. package/styles/dark.js +1 -1
  553. package/styles/darkmoss.js +1 -1
  554. package/styles/darktooth.js +1 -1
  555. package/styles/decaf.js +1 -1
  556. package/styles/default-dark.js +1 -1
  557. package/styles/default-light.js +1 -1
  558. package/styles/default.js +1 -1
  559. package/styles/devibeans.js +1 -1
  560. package/styles/dirtysea.js +1 -1
  561. package/styles/docco.js +1 -1
  562. package/styles/dracula.js +1 -1
  563. package/styles/dusk-dark.js +1 -1
  564. package/styles/dusk-light.js +1 -1
  565. package/styles/edge-dark.js +1 -1
  566. package/styles/edge-light.js +1 -1
  567. package/styles/eighties.js +1 -1
  568. package/styles/embers.js +1 -1
  569. package/styles/equilibrium-dark.js +1 -1
  570. package/styles/equilibrium-gray-dark.js +1 -1
  571. package/styles/equilibrium-gray-light.js +1 -1
  572. package/styles/equilibrium-light.js +1 -1
  573. package/styles/equinox.js +1 -1
  574. package/styles/espresso.js +1 -1
  575. package/styles/eva-dim.js +1 -1
  576. package/styles/eva.js +1 -1
  577. package/styles/far.js +1 -1
  578. package/styles/fauve-dark.js +1 -1
  579. package/styles/fauve-light.js +1 -1
  580. package/styles/felipec.js +1 -1
  581. package/styles/ferrofluid-dark.js +1 -1
  582. package/styles/ferrofluid-light.js +1 -1
  583. package/styles/flat.js +1 -1
  584. package/styles/flint-dark.js +1 -1
  585. package/styles/flint-light.js +1 -1
  586. package/styles/foundation.js +1 -1
  587. package/styles/foxfire-dark.js +1 -1
  588. package/styles/foxfire-light.js +1 -1
  589. package/styles/framer.js +1 -1
  590. package/styles/fruit-soda.js +1 -1
  591. package/styles/gamboge-dark.js +1 -1
  592. package/styles/gamboge-light.js +1 -1
  593. package/styles/gigavolt.js +1 -1
  594. package/styles/github-dark-dimmed.js +1 -1
  595. package/styles/github-dark.js +1 -1
  596. package/styles/github.js +1 -1
  597. package/styles/gml.js +1 -1
  598. package/styles/google-dark.js +1 -1
  599. package/styles/google-light.js +1 -1
  600. package/styles/googlecode.js +1 -1
  601. package/styles/gradient-dark.js +1 -1
  602. package/styles/gradient-light.js +1 -1
  603. package/styles/grayscale-dark.js +1 -1
  604. package/styles/grayscale-light.js +1 -1
  605. package/styles/grayscale.js +1 -1
  606. package/styles/green-screen.js +1 -1
  607. package/styles/gruvbox-dark-hard.js +1 -1
  608. package/styles/gruvbox-dark-medium.js +1 -1
  609. package/styles/gruvbox-dark-pale.js +1 -1
  610. package/styles/gruvbox-dark-soft.js +1 -1
  611. package/styles/gruvbox-light-hard.js +1 -1
  612. package/styles/gruvbox-light-medium.js +1 -1
  613. package/styles/gruvbox-light-soft.js +1 -1
  614. package/styles/haar-dark.js +1 -1
  615. package/styles/haar-light.js +1 -1
  616. package/styles/hardcore.js +1 -1
  617. package/styles/harmonic16-dark.js +1 -1
  618. package/styles/harmonic16-light.js +1 -1
  619. package/styles/heetch-dark.js +1 -1
  620. package/styles/heetch-light.js +1 -1
  621. package/styles/helios.js +1 -1
  622. package/styles/hojicha-dark.js +1 -1
  623. package/styles/hojicha-light.js +1 -1
  624. package/styles/hopscotch.js +1 -1
  625. package/styles/horizon-dark.js +1 -1
  626. package/styles/horizon-light.js +1 -1
  627. package/styles/humanoid-dark.js +1 -1
  628. package/styles/humanoid-light.js +1 -1
  629. package/styles/hybrid.js +1 -1
  630. package/styles/ia-dark.js +1 -1
  631. package/styles/ia-light.js +1 -1
  632. package/styles/icy-dark.js +1 -1
  633. package/styles/idea.js +1 -1
  634. package/styles/index.js +348 -348
  635. package/styles/intellij-light.js +1 -1
  636. package/styles/ir-black.js +1 -1
  637. package/styles/isbl-editor-dark.js +1 -1
  638. package/styles/isbl-editor-light.js +1 -1
  639. package/styles/isotope.js +1 -1
  640. package/styles/kimber.js +1 -1
  641. package/styles/kimbie-dark.js +1 -1
  642. package/styles/kimbie-light.js +1 -1
  643. package/styles/kintsugi-dark.js +1 -1
  644. package/styles/kintsugi-light.js +1 -1
  645. package/styles/letterpress-dark.js +1 -1
  646. package/styles/letterpress-light.js +1 -1
  647. package/styles/lichen-dark.js +1 -1
  648. package/styles/lichen-light.js +1 -1
  649. package/styles/lightfair.js +1 -1
  650. package/styles/lioshi.js +1 -1
  651. package/styles/london-tube.js +1 -1
  652. package/styles/lumen-dark.js +1 -1
  653. package/styles/lumen-light.js +1 -1
  654. package/styles/macintosh.js +1 -1
  655. package/styles/magula.js +1 -1
  656. package/styles/mandarinfish-dark.js +1 -1
  657. package/styles/mandarinfish-light.js +1 -1
  658. package/styles/marrakesh.js +1 -1
  659. package/styles/materia.js +1 -1
  660. package/styles/material-darker.js +1 -1
  661. package/styles/material-lighter.js +1 -1
  662. package/styles/material-palenight.js +1 -1
  663. package/styles/material-vivid.js +1 -1
  664. package/styles/material.js +1 -1
  665. package/styles/mellow-purple.js +1 -1
  666. package/styles/memphis-dark.js +1 -1
  667. package/styles/memphis-light.js +1 -1
  668. package/styles/mexico-light.js +1 -1
  669. package/styles/mocha.js +1 -1
  670. package/styles/mono-blue.js +1 -1
  671. package/styles/monokai-sublime.js +1 -1
  672. package/styles/monokai.js +1 -1
  673. package/styles/motherboard-dark.js +1 -1
  674. package/styles/motherboard-light.js +1 -1
  675. package/styles/nacre-dark.js +1 -1
  676. package/styles/nacre-light.js +1 -1
  677. package/styles/nebula.js +1 -1
  678. package/styles/night-owl.js +1 -1
  679. package/styles/nnfx-dark.js +1 -1
  680. package/styles/nnfx-light.js +1 -1
  681. package/styles/nord.js +1 -1
  682. package/styles/nova.js +1 -1
  683. package/styles/obsidian.js +1 -1
  684. package/styles/ocean.js +1 -1
  685. package/styles/oceanicnext.js +1 -1
  686. package/styles/one-light.js +1 -1
  687. package/styles/onedark.js +1 -1
  688. package/styles/outrun-dark.js +1 -1
  689. package/styles/panda-syntax-dark.js +1 -1
  690. package/styles/panda-syntax-light.js +1 -1
  691. package/styles/papercolor-dark.js +1 -1
  692. package/styles/papercolor-light.js +1 -1
  693. package/styles/paraiso-dark.js +1 -1
  694. package/styles/paraiso-light.js +1 -1
  695. package/styles/paraiso.js +1 -1
  696. package/styles/pasque.js +1 -1
  697. package/styles/peat-dark.js +1 -1
  698. package/styles/peat-light.js +1 -1
  699. package/styles/phd.js +1 -1
  700. package/styles/pico.js +1 -1
  701. package/styles/pitaya-dark.js +1 -1
  702. package/styles/pitaya-light.js +1 -1
  703. package/styles/pojoaque.js +1 -1
  704. package/styles/pop.js +1 -1
  705. package/styles/porple.js +1 -1
  706. package/styles/purebasic.js +1 -1
  707. package/styles/qtcreator-dark.js +1 -1
  708. package/styles/qtcreator-light.js +1 -1
  709. package/styles/qualia.js +1 -1
  710. package/styles/railscasts.js +1 -1
  711. package/styles/rainbow.js +1 -1
  712. package/styles/rebecca.js +1 -1
  713. package/styles/ros-pine-dawn.js +1 -1
  714. package/styles/ros-pine-moon.js +1 -1
  715. package/styles/ros-pine.js +1 -1
  716. package/styles/rose-pine-dawn.js +1 -1
  717. package/styles/rose-pine-moon.js +1 -1
  718. package/styles/rose-pine.js +1 -1
  719. package/styles/routeros.js +1 -1
  720. package/styles/sagelight.js +1 -1
  721. package/styles/sandcastle.js +1 -1
  722. package/styles/school-book.js +1 -1
  723. package/styles/scoria-dark.js +1 -1
  724. package/styles/scoria-light.js +1 -1
  725. package/styles/selenite-dark.js +1 -1
  726. package/styles/selenite-light.js +1 -1
  727. package/styles/seti-ui.js +1 -1
  728. package/styles/shades-of-purple.js +1 -1
  729. package/styles/shapeshifter.js +1 -1
  730. package/styles/silk-dark.js +1 -1
  731. package/styles/silk-light.js +1 -1
  732. package/styles/snazzy.js +1 -1
  733. package/styles/solar-flare-light.js +1 -1
  734. package/styles/solar-flare.js +1 -1
  735. package/styles/solarized-dark.js +1 -1
  736. package/styles/solarized-light.js +1 -1
  737. package/styles/spacemacs.js +1 -1
  738. package/styles/srcery.js +1 -1
  739. package/styles/stackoverflow-dark.js +1 -1
  740. package/styles/stackoverflow-light.js +1 -1
  741. package/styles/strelitzia-dark.js +1 -1
  742. package/styles/strelitzia-light.js +1 -1
  743. package/styles/sumi-dark.js +1 -1
  744. package/styles/sumi-light.js +1 -1
  745. package/styles/suminagashi-dark.js +1 -1
  746. package/styles/suminagashi-light.js +1 -1
  747. package/styles/summercamp.js +1 -1
  748. package/styles/summerfruit-dark.js +1 -1
  749. package/styles/summerfruit-light.js +1 -1
  750. package/styles/sunburst.js +1 -1
  751. package/styles/synth-midnight-terminal-dark.js +1 -1
  752. package/styles/synth-midnight-terminal-light.js +1 -1
  753. package/styles/tango.js +1 -1
  754. package/styles/tender.js +1 -1
  755. package/styles/terrazzo-dark.js +1 -1
  756. package/styles/terrazzo-light.js +1 -1
  757. package/styles/thermal-dark.js +1 -1
  758. package/styles/thermal-light.js +1 -1
  759. package/styles/tidepool-dark.js +1 -1
  760. package/styles/tidepool-light.js +1 -1
  761. package/styles/tokyo-night-dark.js +1 -1
  762. package/styles/tokyo-night-light.js +1 -1
  763. package/styles/tomorrow-night-blue.js +1 -1
  764. package/styles/tomorrow-night-bright.js +1 -1
  765. package/styles/tomorrow-night.js +1 -1
  766. package/styles/tomorrow.js +1 -1
  767. package/styles/tourmaline-dark.js +1 -1
  768. package/styles/tourmaline-light.js +1 -1
  769. package/styles/tropicalia-dark.js +1 -1
  770. package/styles/tropicalia-light.js +1 -1
  771. package/styles/twilight.js +1 -1
  772. package/styles/unikitty-dark.js +1 -1
  773. package/styles/unikitty-light.js +1 -1
  774. package/styles/uranium-dark.js +1 -1
  775. package/styles/uranium-light.js +1 -1
  776. package/styles/urushi-dark.js +1 -1
  777. package/styles/urushi-light.js +1 -1
  778. package/styles/verdigris-dark.js +1 -1
  779. package/styles/verdigris-light.js +1 -1
  780. package/styles/vitriol-dark.js +1 -1
  781. package/styles/vitriol-light.js +1 -1
  782. package/styles/vs-dark.js +1 -1
  783. package/styles/vs.js +1 -1
  784. package/styles/vs2015.js +1 -1
  785. package/styles/vulcan.js +1 -1
  786. package/styles/wet-plate-dark.js +1 -1
  787. package/styles/wet-plate-light.js +1 -1
  788. package/styles/windows-10-light.js +1 -1
  789. package/styles/windows-10.js +1 -1
  790. package/styles/windows-95-light.js +1 -1
  791. package/styles/windows-95.js +1 -1
  792. package/styles/windows-high-contrast-light.js +1 -1
  793. package/styles/windows-high-contrast.js +1 -1
  794. package/styles/windows-nt-light.js +1 -1
  795. package/styles/windows-nt.js +1 -1
  796. package/styles/woad-dark.js +1 -1
  797. package/styles/woad-light.js +1 -1
  798. package/styles/woodland.js +1 -1
  799. package/styles/xcode-dusk.js +1 -1
  800. package/styles/xcode.js +1 -1
  801. package/styles/xt256.js +1 -1
  802. package/styles/zenburn.js +1 -1
  803. package/textmate-theme.d.ts +23 -0
  804. package/textmate-theme.js +89 -0
  805. package/theme-style.js +61 -11
  806. package/theme-vars.js +25 -0
  807. package/theme.d.ts +16 -0
  808. package/theme.js +80 -0
  809. package/themes/3024.js +1 -2
  810. package/themes/a11y-dark.js +1 -2
  811. package/themes/a11y-light.js +1 -2
  812. package/themes/agate.js +1 -2
  813. package/themes/apathy.js +1 -2
  814. package/themes/apprentice.js +1 -2
  815. package/themes/ashes.js +1 -2
  816. package/themes/atelier-cave-light.js +1 -2
  817. package/themes/atelier-cave.js +1 -2
  818. package/themes/atelier-dune-light.js +1 -2
  819. package/themes/atelier-dune.js +1 -2
  820. package/themes/atelier-estuary-light.js +1 -2
  821. package/themes/atelier-estuary.js +1 -2
  822. package/themes/atelier-forest-light.js +1 -2
  823. package/themes/atelier-forest.js +1 -2
  824. package/themes/atelier-heath-light.js +1 -2
  825. package/themes/atelier-heath.js +1 -2
  826. package/themes/atelier-lakeside-light.js +1 -2
  827. package/themes/atelier-lakeside.js +1 -2
  828. package/themes/atelier-plateau-light.js +1 -2
  829. package/themes/atelier-plateau.js +1 -2
  830. package/themes/atelier-savanna-light.js +1 -2
  831. package/themes/atelier-savanna.js +1 -2
  832. package/themes/atelier-seaside-light.js +1 -2
  833. package/themes/atelier-seaside.js +1 -2
  834. package/themes/atelier-sulphurpool-light.js +1 -2
  835. package/themes/atelier-sulphurpool.js +1 -2
  836. package/themes/atlas.js +1 -2
  837. package/themes/base16-github.js +1 -2
  838. package/themes/base16-ir-black.js +1 -2
  839. package/themes/base16-monokai.js +1 -2
  840. package/themes/base16-nord.js +1 -2
  841. package/themes/bespin.js +1 -2
  842. package/themes/black-metal-bathory.js +1 -2
  843. package/themes/black-metal-burzum.js +1 -2
  844. package/themes/black-metal-dark-funeral.js +1 -2
  845. package/themes/black-metal-gorgoroth.js +1 -2
  846. package/themes/black-metal-immortal.js +1 -2
  847. package/themes/black-metal-khold.js +1 -2
  848. package/themes/black-metal-marduk.js +1 -2
  849. package/themes/black-metal-mayhem.js +1 -2
  850. package/themes/black-metal-nile.js +1 -2
  851. package/themes/black-metal-venom.js +1 -2
  852. package/themes/black-metal.js +1 -2
  853. package/themes/brewer.js +1 -2
  854. package/themes/bright.js +1 -2
  855. package/themes/brogrammer.js +1 -2
  856. package/themes/brown-paper.js +1 -2
  857. package/themes/brush-trees-dark.js +1 -2
  858. package/themes/brush-trees.js +1 -2
  859. package/themes/chalk.js +1 -2
  860. package/themes/circus.js +1 -2
  861. package/themes/classic-dark.js +1 -2
  862. package/themes/classic-light.js +1 -2
  863. package/themes/codeschool.js +1 -2
  864. package/themes/colors.js +1 -2
  865. package/themes/cupcake.js +1 -2
  866. package/themes/cupertino.js +1 -2
  867. package/themes/cybertopia-cherry.js +1 -2
  868. package/themes/cybertopia-dimmer.js +1 -2
  869. package/themes/cybertopia-icecap.js +1 -2
  870. package/themes/cybertopia-saturated.js +1 -2
  871. package/themes/danqing.js +1 -2
  872. package/themes/darcula.js +1 -2
  873. package/themes/dark-violet.js +1 -2
  874. package/themes/darkmoss.js +1 -2
  875. package/themes/darktooth.js +1 -2
  876. package/themes/decaf.js +1 -2
  877. package/themes/default-dark.js +1 -2
  878. package/themes/default-light.js +1 -2
  879. package/themes/dirtysea.js +1 -2
  880. package/themes/dracula.js +1 -2
  881. package/themes/edge-dark.js +1 -2
  882. package/themes/edge-light.js +1 -2
  883. package/themes/eighties.js +1 -2
  884. package/themes/embers.js +1 -2
  885. package/themes/equilibrium-dark.js +1 -2
  886. package/themes/equilibrium-gray-dark.js +1 -2
  887. package/themes/equilibrium-gray-light.js +1 -2
  888. package/themes/equilibrium-light.js +1 -2
  889. package/themes/espresso.js +1 -2
  890. package/themes/eva-dim.js +1 -2
  891. package/themes/eva.js +1 -2
  892. package/themes/felipec.js +1 -2
  893. package/themes/flat.js +1 -2
  894. package/themes/framer.js +1 -2
  895. package/themes/fruit-soda.js +1 -2
  896. package/themes/gigavolt.js +1 -2
  897. package/themes/google-dark.js +1 -2
  898. package/themes/google-light.js +1 -2
  899. package/themes/gradient-dark.js +1 -2
  900. package/themes/gradient-light.js +1 -2
  901. package/themes/grayscale-dark.js +1 -2
  902. package/themes/grayscale-light.js +1 -2
  903. package/themes/grayscale.js +1 -2
  904. package/themes/green-screen.js +1 -2
  905. package/themes/gruvbox-dark-hard.js +1 -2
  906. package/themes/gruvbox-dark-medium.js +1 -2
  907. package/themes/gruvbox-dark-pale.js +1 -2
  908. package/themes/gruvbox-dark-soft.js +1 -2
  909. package/themes/gruvbox-light-hard.js +1 -2
  910. package/themes/gruvbox-light-medium.js +1 -2
  911. package/themes/gruvbox-light-soft.js +1 -2
  912. package/themes/hardcore.js +1 -2
  913. package/themes/harmonic16-dark.js +1 -2
  914. package/themes/harmonic16-light.js +1 -2
  915. package/themes/heetch-dark.js +1 -2
  916. package/themes/heetch-light.js +1 -2
  917. package/themes/helios.js +1 -2
  918. package/themes/hopscotch.js +1 -2
  919. package/themes/horizon-dark.js +1 -2
  920. package/themes/horizon-light.js +1 -2
  921. package/themes/humanoid-dark.js +1 -2
  922. package/themes/humanoid-light.js +1 -2
  923. package/themes/hybrid.js +1 -2
  924. package/themes/ia-dark.js +1 -2
  925. package/themes/ia-light.js +1 -2
  926. package/themes/icy-dark.js +1 -2
  927. package/themes/index.js +348 -348
  928. package/themes/isotope.js +1 -2
  929. package/themes/kimber.js +1 -2
  930. package/themes/london-tube.js +1 -2
  931. package/themes/macintosh.js +1 -2
  932. package/themes/marrakesh.js +1 -2
  933. package/themes/materia.js +1 -2
  934. package/themes/material-darker.js +1 -2
  935. package/themes/material-lighter.js +1 -2
  936. package/themes/material-palenight.js +1 -2
  937. package/themes/material-vivid.js +1 -2
  938. package/themes/material.js +1 -2
  939. package/themes/mellow-purple.js +1 -2
  940. package/themes/mexico-light.js +1 -2
  941. package/themes/mocha.js +1 -2
  942. package/themes/nebula.js +1 -2
  943. package/themes/nnfx-dark.js +1 -2
  944. package/themes/nnfx-light.js +1 -2
  945. package/themes/nord.js +1 -2
  946. package/themes/nova.js +1 -2
  947. package/themes/ocean.js +1 -2
  948. package/themes/oceanicnext.js +1 -2
  949. package/themes/one-light.js +1 -2
  950. package/themes/onedark.js +1 -2
  951. package/themes/outrun-dark.js +1 -2
  952. package/themes/papercolor-dark.js +1 -2
  953. package/themes/papercolor-light.js +1 -2
  954. package/themes/paraiso.js +1 -2
  955. package/themes/pasque.js +1 -2
  956. package/themes/phd.js +1 -2
  957. package/themes/pico.js +1 -2
  958. package/themes/pojoaque.js +1 -2
  959. package/themes/pop.js +1 -2
  960. package/themes/porple.js +1 -2
  961. package/themes/qualia.js +1 -2
  962. package/themes/railscasts.js +1 -2
  963. package/themes/rebecca.js +1 -2
  964. package/themes/ros-pine-dawn.js +1 -2
  965. package/themes/ros-pine-moon.js +1 -2
  966. package/themes/ros-pine.js +1 -2
  967. package/themes/sagelight.js +1 -2
  968. package/themes/sandcastle.js +1 -2
  969. package/themes/seti-ui.js +1 -2
  970. package/themes/shapeshifter.js +1 -2
  971. package/themes/silk-dark.js +1 -2
  972. package/themes/silk-light.js +1 -2
  973. package/themes/snazzy.js +1 -2
  974. package/themes/solar-flare-light.js +1 -2
  975. package/themes/solar-flare.js +1 -2
  976. package/themes/solarized-dark.js +1 -2
  977. package/themes/solarized-light.js +1 -2
  978. package/themes/spacemacs.js +1 -2
  979. package/themes/summercamp.js +1 -2
  980. package/themes/summerfruit-dark.js +1 -2
  981. package/themes/summerfruit-light.js +1 -2
  982. package/themes/synth-midnight-terminal-dark.js +1 -2
  983. package/themes/synth-midnight-terminal-light.js +1 -2
  984. package/themes/tango.js +1 -2
  985. package/themes/tender.js +1 -2
  986. package/themes/tomorrow-night.js +1 -2
  987. package/themes/tomorrow.js +1 -2
  988. package/themes/twilight.js +1 -2
  989. package/themes/unikitty-dark.js +1 -2
  990. package/themes/unikitty-light.js +1 -2
  991. package/themes/vs2015.js +1 -2
  992. package/themes/vulcan.js +1 -2
  993. package/themes/windows-10-light.js +1 -2
  994. package/themes/windows-10.js +1 -2
  995. package/themes/windows-95-light.js +1 -2
  996. package/themes/windows-95.js +1 -2
  997. package/themes/windows-high-contrast-light.js +1 -2
  998. package/themes/windows-high-contrast.js +1 -2
  999. package/themes/windows-nt-light.js +1 -2
  1000. package/themes/windows-nt.js +1 -2
  1001. package/themes/woodland.js +1 -2
  1002. package/themes/xcode-dusk.js +1 -2
  1003. package/themes/zenburn.js +1 -2
  1004. package/tokenized-document.d.ts +6 -0
  1005. package/tokenized-document.js +13 -0
  1006. package/typewriter-units.d.ts +13 -0
  1007. package/typewriter-units.js +36 -0
package/README.md CHANGED
@@ -38,6 +38,8 @@ Import languages from `svelte-highlight/languages`.
38
38
 
39
39
  See [SUPPORTED_LANGUAGES.md](SUPPORTED_LANGUAGES.md) for a list of supported languages.
40
40
 
41
+ `code` accepts any value and is coerced with `String(code ?? "")`: an object like `{}` renders as `"[object Object]"`, while `undefined`/`null` render as nothing.
42
+
41
43
  ```svelte
42
44
  <script>
43
45
  import Highlight from "svelte-highlight";
@@ -49,6 +51,16 @@ See [SUPPORTED_LANGUAGES.md](SUPPORTED_LANGUAGES.md) for a list of supported lan
49
51
  <Highlight language={typescript} {code} />
50
52
  ```
51
53
 
54
+ ### Wrapping Long Lines
55
+
56
+ By default, overflowing horizontal content is contained by a scrollbar. Set `wrap` to `true` to wrap long lines instead.
57
+
58
+ ```svelte
59
+ <Highlight wrap language={typescript} {code} />
60
+ ```
61
+
62
+ Don't combine `wrap` with `HighlightStream`'s `virtualize` mode or `HighlightVirtual` -- both assume one fixed-height line per row, which wrapping breaks.
63
+
52
64
  ## Theming
53
65
 
54
66
  Every `highlight.js` theme is also compiled into a **`ThemePalette`**: a typed object of `--shl-*` CSS custom properties plus a shared structural stylesheet (`svelte-highlight/themes/base.css`) that maps `.hljs*` classes to those variables. This is the recommended way to theme new projects — themes are data, scoping is an inline `style` attribute (SSR-safe by construction), and any token is overridable with one CSS line or a Svelte style prop. See [SUPPORTED_THEMES.md](SUPPORTED_THEMES.md) for a list of compiled themes.
@@ -108,7 +120,9 @@ This renders SSR-identical output — no `<svelte:head>`, no `<style>` tag, just
108
120
  </HighlightStyle>
109
121
  ```
110
122
 
111
- This renders `--shl-keyword: light-dark(#a626a4, #c678dd)` (etc.) plus `color-scheme: light dark`. `mode="light"` / `mode="dark"` force `color-scheme: light` / `dark`. Any other `mode` string (the legacy "CSS selector" mode) omits `color-scheme` inline — set it on your own selector for app-controlled switching, e.g. `[data-theme="dark"] { color-scheme: dark }`.
123
+ The wrapper's inline style carries the plain light value for each var (e.g. `--shl-keyword:#a626a4`) — a baseline every browser can render. A scoped, deduped `<style>` tag (gated behind `@supports (color: light-dark(...))`) overrides it with `--shl-keyword: light-dark(#a626a4, #c678dd)` (etc.) plus `color-scheme: light dark` on browsers that support `light-dark()`. `mode="light"` / `mode="dark"` force `color-scheme: light` / `dark`. Any other `mode` string (the legacy "CSS selector" mode) omits `color-scheme` inline — set it on your own selector for app-controlled switching, e.g. `[data-theme="dark"] { color-scheme: dark }`.
124
+
125
+ See it live, with a mode toggle, on the [dual-palette preview page](https://svhe.onrender.com/preview-dual-palette).
112
126
 
113
127
  **One-line customization — any token, no theme forking:**
114
128
 
@@ -159,6 +173,10 @@ Variable names are derived mechanically from the selectors found in `highlight.j
159
173
 
160
174
  `base.css` assumes the default `hljs-` class prefix; projects using a custom `classPrefix` should stay on the legacy string path below.
161
175
 
176
+ `HighlightStyle` also inlines `color-scheme` from the palette(s) it's given — `palette.colorScheme` for a single `theme`, or a value derived from `mode` for a `light`/`dark` pair — so native form controls and scrollbars inside a themed block follow the theme too.
177
+
178
+ `extras` isn't a corner case for every theme — e.g. the `3024` theme's `extras` covers 7 declarations, including `.hljs ::selection`, `.hljs::selection`, `.hljs-operator`, and `.ruby .hljs-property`, all silently dropped when that theme is imported as a `ThemePalette` object (`svelte-highlight/themes/3024`) instead of its `.css` artifact. There's no per-theme fidelity indicator today; [SUPPORTED_THEMES.md](SUPPORTED_THEMES.md) is where one could eventually live.
179
+
162
180
  ### Creating themes
163
181
 
164
182
  `svelte-highlight/theme` exports a typed, programmatic way to build or derive `ThemePalette` objects, instead of hand-writing `--shl-*` vars against the full scope vocabulary.
@@ -195,7 +213,7 @@ const midnight = defineTheme({
195
213
  </HighlightStyle>
196
214
  ```
197
215
 
198
- `roles` are `foreground`, `background`, `comment`, `keyword`, `string`, `literal`, `function`, `type`, `variable`, `property`, `tag`, `punctuation`, `meta`, `addition`, `deletion` — each expands to a documented set of `--shl-*` scope vars. A bare string is shorthand for `{ color: string }`; both roles and `scopes` also accept a `{ color, background, fontStyle, fontWeight, textDecoration }` object. Precedence is `extends` palette vars → `roles` → `scopes` (later layers win per-var, not per-role). `foreground`/`background` are required unless `extends` is given.
216
+ `roles` are `foreground`, `background`, `comment`, `keyword`, `string`, `literal`, `function`, `type`, `variable`, `property`, `tag`, `punctuation`, `meta`, `addition`, `deletion` — each expands to a documented set of `--shl-*` scope vars. A bare string is shorthand for `{ color: string }`; both roles and `scopes` also accept a `{ color, background, fontStyle, fontWeight, textDecoration }` object. Precedence is `extends` palette vars → `roles` → `scopes` (later layers win per-var, not per-role). `foreground`/`background` are required unless `extends` is given. `ROLE_SCOPES` is exported for tooling that wants to enumerate exactly which scopes a role expands to.
199
217
 
200
218
  **`extendTheme()`** derives a new palette from any shipped or user palette with role- or scope-level overrides:
201
219
 
@@ -219,6 +237,21 @@ writeFileSync("public/midnight.css", paletteToCss(midnight));
219
237
 
220
238
  `defineTheme` output is a plain `ThemePalette` — spreadable, serializable, diffable, and valid everywhere shipped palettes work, per [Themes are data](#theming) above.
221
239
 
240
+ **`validatePalette()`** self-checks a `ThemePalette` — useful for a hand-built or hand-edited palette, e.g. one assembled via the [Themes are data](#theming) spread pattern above:
241
+
242
+ ```js
243
+ import { validatePalette } from "svelte-highlight/theme";
244
+
245
+ const custom = {
246
+ ...atomOneDark,
247
+ vars: { ...atomOneDark.vars, "--shl-keyword": "#ff79c6" },
248
+ };
249
+
250
+ validatePalette(custom); // -> [] when clean; otherwise a list of issues
251
+ ```
252
+
253
+ It flags a missing/malformed `vars` object, a missing `--shl-fg`/`--shl-bg`, a `vars` key outside the `--shl-*` grammar, and a `--shl-fg`/`--shl-bg` value that doesn't look like a recognized color — never throws. `defineTheme` already runs it (plus an unknown-`scopes`-key check) automatically in dev mode.
254
+
222
255
  ### Importing VS Code themes
223
256
 
224
257
  `svelte-highlight/theme/textmate` imports VS Code / TextMate theme JSON (thousands of existing editor themes) into a `ThemePalette`:
@@ -230,7 +263,7 @@ import nightOwl from "./night-owl-color-theme.json" with { type: "json" };
230
263
  const palette = fromTextMate(nightOwl);
231
264
  ```
232
265
 
233
- `fromTextMate` accepts a **parsed object** only — VS Code themes are often JSONC, so parsing is the caller's job. The scope mapping is best-effort: TextMate scope selectors are matched against a starter table by segment-prefix (`"entity.name.function"` matches `"entity.name.function.method.ts"`), with the most specific (longest) match winning ties broken by the later `tokenColors` entry — the same specificity semantics VS Code itself uses. Entries that don't map to anything are never silently dropped; pass `onWarn` to observe them:
266
+ `fromTextMate` accepts a **parsed object** only — VS Code themes are often JSONC, so parsing is the caller's job. The scope mapping is best-effort: TextMate scope selectors are matched against a starter table by segment-prefix (`"entity.name.function"` matches `"entity.name.function.method.ts"`), with the most specific (longest) match winning ties broken by the later `tokenColors` entry — the same specificity semantics VS Code itself uses. The starter table covers common scopes, including Markdown code spans/fences and invalid/illegal markers; because matching generalizes by prefix, a row like `"keyword"` already resolves any more-specific scope sharing that prefix, so `"keyword.control"` and `"keyword.operator"` resolve differently without needing a dedicated row for each. Entries that don't map to anything are never silently dropped; pass `onWarn` to observe them:
234
267
 
235
268
  ```js
236
269
  const palette = fromTextMate(nightOwl, {
@@ -238,9 +271,28 @@ const palette = fromTextMate(nightOwl, {
238
271
  });
239
272
  ```
240
273
 
274
+ To count unmapped entries instead of observing each one as it happens, use `fromTextMateWithWarnings`, which aggregates every `onWarn` call:
275
+
276
+ ```js
277
+ import { fromTextMateWithWarnings } from "svelte-highlight/theme/textmate";
278
+
279
+ const { palette, warnings } = fromTextMateWithWarnings(nightOwl);
280
+ // warnings.length is the number of unmapped tokenColors entries
281
+ ```
282
+
283
+ When present, `theme.semanticTokenColors` is read as a higher-priority overlay on top of `tokenColors` — matching VS Code's own precedence when semantic highlighting is enabled. It's resolved against a starter table of VS Code's default semantic token types (`namespace`, `class`, `interface`, `enum`, `struct`, `typeParameter`, `type`, `parameter`, `variable`, `enumMember`, `property`, `event`, `decorator`, `label`, `function`, `method`, `macro`, `comment`, `string`, `keyword`, `number`, `regexp`, `operator`); modifiers (`"variable.readonly"`) and language scoping (`"variable:typescript"`) are not resolved — only the base type before the first `.` or `:` is matched.
284
+
285
+ `fromTextMate` never populates `ThemePalette.extras` — `editor.background` is always read as a single solid color assigned straight to `--shl-bg`. This matches VS Code's own model (VS Code doesn't support gradients for `editor.background` either), so it's a deliberate, low-risk scope cut rather than a gap to fix.
286
+
287
+ Real VS Code theme files are usually JSONC (comments, trailing commas), which `fromTextMate` doesn't accept directly. `scripts/import-textmate-theme.ts` is a local dev recipe — not an installed CLI — that strips comments/trailing commas and writes the resulting `ThemePalette` as JSON; copy it into your own project and adapt as needed:
288
+
289
+ ```sh
290
+ bun scripts/import-textmate-theme.ts ./night-owl-color-theme.json ./night-owl.palette.json
291
+ ```
292
+
241
293
  ## Styling
242
294
 
243
- Import styles from `svelte-highlight/styles`. See [SUPPORTED_STYLES.md](SUPPORTED_STYLES.md) for a list of supported styles. For new projects, prefer [Theming](#theming) above — this is the original, string-based theming path, kept fully supported for backward compatibility.
295
+ Import styles from `svelte-highlight/styles`. See [SUPPORTED_STYLES.md](SUPPORTED_STYLES.md) for a list of supported styles. For new projects, prefer [Theming](#theming) above — this is the original, string-based theming path, kept fully supported for backward compatibility. Legacy styles are stable and will not be removed. One concrete reason to pick this path over `ThemePalette`: `base.css` assumes the default `hljs-` class prefix, so projects using a custom `classPrefix` should stay here.
244
296
 
245
297
  There are two ways to apply `highlight.js` styles.
246
298
 
@@ -267,6 +319,10 @@ This component exports `highlight.js` themes in JavaScript. Import the theme fro
267
319
  <Highlight language={typescript} {code} />
268
320
  ```
269
321
 
322
+ Under a strict Content Security Policy without `'unsafe-inline'` for `style-src`, the browser silently drops this injected `<style>` tag with no visible error. Use [CSS StyleSheet](#css-stylesheet) below instead, which is CSP-safe by construction since it's a normal stylesheet reference.
323
+
324
+ This snippet also has no protection against duplicate `<style>` tags: placing it inside a component that's mounted more than once emits one `<style>` tag per mount. For anything mounted more than once, use [`HighlightStyle`](#highlightstyle) instead, which dedupes automatically across instances of the same theme.
325
+
270
326
  ### CSS StyleSheet
271
327
 
272
328
  Depending on your set-up, importing a CSS StyleSheet in Svelte may require a CSS file loader. SvelteKit/Vite automatically supports this. For Webpack, refer to [examples/webpack](examples/webpack).
@@ -341,10 +397,22 @@ Wrap each `Highlight` in `HighlightStyle` to keep a theme on that block:
341
397
 
342
398
  The component prefixes each selector with a scope class on the wrapper, so the theme only hits markup inside it.
343
399
 
344
- `theme` is required. `scopeClass` defaults to a hash of the theme string. Pass your own, or bind it (`bind:scopeClass`) / read it from the slot (`let:scopeClass`).
400
+ `theme` is required. `scopeClass` defaults to a hash of the theme string. Pass your own, or bind it (`bind:scopeClass`) / read it from the slot (`let:scopeClass`). An empty string is treated the same as omitting `scopeClass` — it falls back to the auto-hash. `scopeClass` must be a single valid CSS class name; a value like `"a b"` will warn in the console and won't scope as expected.
345
401
 
346
402
  For a page-wide theme, use `{@html theme}` as shown above.
347
403
 
404
+ Under a `style-src` CSP that requires a nonce, pass `nonce` and it's attached to the `<style>` tag `HighlightStyle` injects into `<svelte:head>`:
405
+
406
+ ```svelte
407
+ <HighlightStyle theme={a11yDark} nonce={cspNonce}>
408
+ <Highlight language={typescript} {code} />
409
+ </HighlightStyle>
410
+ ```
411
+
412
+ A single `ThemePalette` (`theme` as an object, not a `light`/`dark` pair) never injects a `<style>` tag at all — only inline vars on the wrapper — so it's unaffected by a `style-src` nonce requirement in the first place; that's a reason to prefer it under a strict CSP.
413
+
414
+ **Known limitation:** on the CSS-string path, server-side rendering emits one `<style>` tag per `HighlightStyle` instance, even when several instances on the page share the exact same theme — the client-side dedupe only kicks in after hydration. This is harmless (CSS is idempotent), but adds extra bytes on pages with many repeated identical-theme instances. The `ThemePalette` object path has no such concern for a single theme, since it never injects a `<style>` tag to begin with.
415
+
348
416
  ### Dark mode
349
417
 
350
418
  `HighlightStyle` can emit a light and a dark theme together and switch between them. Pass `light` and `dark` instead of `theme`:
@@ -378,6 +446,8 @@ The `mode` prop controls how the two themes are switched (default `"auto"`):
378
446
 
379
447
  Both themes are scoped to the wrapper, so different blocks can use different theme pairs on the same page. When `light` and `dark` are both set they take precedence over `theme`; passing only `theme` keeps the existing single-theme behavior unchanged.
380
448
 
449
+ The `ThemePalette` object pair path (`light`/`dark` as [`ThemePalette`s](#theming) rather than CSS strings) works the same way, but resolves the pair via `light-dark()` instead of `prefers-color-scheme`/selector gating. On a browser that predates `light-dark()` support, it now falls back to the light theme instead of rendering broken (unset) colors: a scoped, deduped `<style>` tag applies the `light-dark()` values behind `@supports (color: light-dark(...))`, and the wrapper's own inline style carries the plain light value as the pre-`@supports` baseline. Single-theme (`theme` alone, no pair) SSR-identical guarantees are unaffected either way.
450
+
381
451
  ## Styling with CSS variables
382
452
 
383
453
  Every `Highlight` variant forwards `$$restProps` to its top-level element, so you can style the component using CSS variables without resorting to `:global` overrides or `!important`.
@@ -408,16 +478,19 @@ These apply to the outer container of every component (the `pre` element for `Hi
408
478
 
409
479
  ### `LineNumbers` variables
410
480
 
411
- | Variable | Description | Default value |
412
- | :----------------------- | :------------------------------------------------ | :------------------------ |
413
- | --line-number-color | Text color of the line numbers | `currentColor` |
414
- | --border-color | Border color of the column of line numbers | `currentColor` |
415
- | --highlighted-background | Background color of highlighted lines | `rgba(254, 241, 96, 0.2)` |
416
- | --unhighlighted-opacity | Opacity of un-highlighted lines (focus mode) | `1` |
417
- | --unhighlighted-filter | CSS filter for un-highlighted lines (focus mode) | `none` |
418
- | --padding | Fallback padding for `--padding-left` / `--padding-right` | `1em` |
419
- | --padding-left | Left padding for `td` elements | `var(--padding, 1em)` |
420
- | --padding-right | Right padding for `td` elements | `var(--padding, 1em)` |
481
+ | Variable | Description | Default value |
482
+ | :------------------------ | :------------------------------------------------ | :--------------------------- |
483
+ | --line-number-color | Text color of the line numbers | `currentColor` |
484
+ | --line-number-digit-width | Width of a single gutter digit | `0.6em` |
485
+ | --border-color | Border color of the column of line numbers | `currentColor` |
486
+ | --highlighted-background | Background color of highlighted lines | `rgba(254, 241, 96, 0.2)` |
487
+ | --line-added-background | Background color of `lineStates` `"added"` lines | `rgba(46, 204, 113, 0.15)` |
488
+ | --line-removed-background | Background color of `lineStates` `"removed"` lines | `rgba(231, 76, 60, 0.15)` |
489
+ | --unhighlighted-opacity | Opacity of un-highlighted lines (focus mode) | `1` |
490
+ | --unhighlighted-filter | CSS filter for un-highlighted lines (focus mode) | `none` |
491
+ | --padding | Fallback padding for `--padding-left` / `--padding-right` | `1em` |
492
+ | --padding-left | Left padding for `td` elements | `var(--padding, 1em)` |
493
+ | --padding-right | Right padding for `td` elements | `var(--padding, 1em)` |
421
494
 
422
495
  ### `CopyButton` variables
423
496
 
@@ -445,6 +518,7 @@ These apply when `langtag` is set to `true`.
445
518
  | --langtag-color | Text color of the langtag | `inherit` |
446
519
  | --langtag-border-radius | Border radius of the langtag | `0` |
447
520
  | --langtag-padding | Padding of the langtag | `1em` |
521
+ | --langtag-font-size | Font size of the langtag | `inherit` |
448
522
 
449
523
  ### `CodeWindow` variables
450
524
 
@@ -469,16 +543,36 @@ These apply when `langtag` is set to `true`.
469
543
  | --prompt-font-weight | Font weight of the terminal prompt | `700` |
470
544
  | --prompt-color | Color of the terminal prompt | `inherit` |
471
545
 
546
+ ### `FileTabs` variables
547
+
548
+ | Variable | Description | Default value |
549
+ | :---------------------- | :--------------------------------------------------------------- | :-------------------------------------------- |
550
+ | --file-tabs-gap | Gap between tabs | `0` |
551
+ | --file-tabs-background | Tab strip background | `inherit` |
552
+ | --tab-overflow-fade | Width of the scroll shadow shown on the overflowing edge | `1.5rem` |
553
+ | --tab-padding | Padding of each tab | `0.5em 1em` |
554
+ | --tab-color | Text color of inactive tabs | `inherit` |
555
+ | --tab-background | Background color of inactive tabs | `transparent` |
556
+ | --tab-inactive-opacity | Opacity of inactive tabs (active and hovered tabs stay opaque) | `0.55` |
557
+ | --tab-active-color | Text color of the active tab | the highlighted code's text color |
558
+ | --tab-active-background | Background color of the active tab | the highlighted code's background |
559
+ | --tab-focus-outline | Keyboard focus outline of a tab | `2px solid currentColor` |
560
+
472
561
  ## Svelte Syntax Highlighting
473
562
 
474
- Use the `HighlightSvelte` component for Svelte syntax highlighting.
563
+ Use the `HighlightSvelte` component for Svelte syntax highlighting. Its grammar understands Svelte 5 runes (`$state`, `$derived`, `$effect` and its suffixed forms, `$props.id`, `$inspect.trace`), store auto-subscription (`$store`, `$store()`, `$store.prop`), `lang="ts"`/`context="module"` script-block resolution, and directive shorthand (`on:`, `bind:`, `use:`, and friends) — genuinely ahead of generic HTML-plus-embedded-JS Svelte highlighting, which has no notion that runes exist.
475
564
 
476
565
  ```svelte
477
566
  <script>
478
567
  import { HighlightSvelte } from "svelte-highlight";
479
568
  import github from "svelte-highlight/styles/github";
480
569
 
481
- const code = `<button on:click={() => { console.log(0); }}>Increment {count}</button>`;
570
+ const code = `<script>
571
+ let count = $state(0);
572
+ let doubled = $derived(count * 2);
573
+ <\/script>
574
+
575
+ <button on:click={() => count++}>{doubled} (store: {$externalCount})</button>`;
482
576
  </script>
483
577
 
484
578
  <svelte:head>
@@ -488,12 +582,16 @@ Use the `HighlightSvelte` component for Svelte syntax highlighting.
488
582
  <HighlightSvelte {code} />
489
583
  ```
490
584
 
585
+ Nested template declaration tags are also supported — including a second, shadowing `{const ...}` declared inside a nested element within the same `{#each}` block.
586
+
587
+ See the [kitchen-sink live demo](https://svhe.onrender.com/preview-svelte) for a fuller tour of Svelte highlighting across every theme.
588
+
491
589
  ## Auto-highlighting
492
590
 
493
- The `HighlightAuto` component uses the [highlightAuto API](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto) and attempts to guess what grammar to use based on the provided `code`.
591
+ The `HighlightAuto` component uses the [highlightAuto API](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto) and attempts to guess what grammar to use based on the provided `code`. Its `on:highlight` event's `secondBest` field surfaces the runner-up candidate and its relevance, for showing detection confidence.
494
592
 
495
593
  > [!WARNING]
496
- > Auto-highlighting will result in a larger bundle size. Specify a language if possible.
594
+ > Mounting `HighlightAuto` statically imports all 279 shipped grammars, regardless of `languageNames`, so bundle size is unconditionally larger than a `Highlight` with a single named language. Specify a language if possible.
497
595
 
498
596
  ```svelte
499
597
  <script>
@@ -512,7 +610,7 @@ The `HighlightAuto` component uses the [highlightAuto API](https://highlightjs.r
512
610
 
513
611
  ### Limiting Language Detection
514
612
 
515
- You can restrict [language auto-detection](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto-value-languagesubset) to a subset using the `languageNames` prop. This can improve performance and accuracy.
613
+ You can restrict [language auto-detection](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto-value-languagesubset) to a subset using the `languageNames` prop. This can improve performance and accuracy — it narrows the candidates scored during detection, but it does not reduce bundle size, since all shipped grammars are imported unconditionally (see the warning above). A grammar registered with `disableAutodetect: true` stays excluded from detection even when explicitly named in `languageNames`.
516
614
 
517
615
  ```svelte
518
616
  <script>
@@ -583,6 +681,30 @@ The line number starts at `1`. Customize this via the `startingLineNumber` prop.
583
681
  </Highlight>
584
682
  ```
585
683
 
684
+ ### Windowed Lines
685
+
686
+ `LineNumbers` re-splits the entire `highlighted` string into lines on every update, which is wasteful once you're already rendering a window out of a much larger document. Pass a pre-split `lines` array instead -- the same per-line HTML shape `svelte-highlight/tokenized-document`'s `lineRange` (see [Large documents](#large-documents)) and `HighlightStream`'s incremental rendering already produce -- and set `lineCount` to the *total* document line count so the gutter is sized for the whole document instead of jittering as the window scrolls. `startingLineNumber` offsets the row numbers to match the window's position; `highlightedLines`/`lineStates` index relative to the `lines` array actually rendered, not the absolute document line.
687
+
688
+ ```svelte
689
+ <script>
690
+ import { LineNumbers } from "svelte-highlight";
691
+ import { createTokenizedDocument } from "svelte-highlight/tokenized-document";
692
+ import typescript from "svelte-highlight/languages/typescript";
693
+
694
+ const doc = createTokenizedDocument({ language: typescript });
695
+ doc.setCode(bigFile);
696
+
697
+ const start = 50_000;
698
+ const end = 50_040;
699
+ </script>
700
+
701
+ <LineNumbers
702
+ lines={doc.lineRange(start, end)}
703
+ startingLineNumber={start + 1}
704
+ lineCount={doc.lineCount()}
705
+ />
706
+ ```
707
+
586
708
  ### Highlighted Lines
587
709
 
588
710
  Specify the lines to highlight using the `highlightedLines` prop. Indices start at zero.
@@ -617,20 +739,49 @@ Use `--highlighted-background` to customize the background color of highlighted
617
739
  </Highlight>
618
740
  ```
619
741
 
742
+ ### Line States
743
+
744
+ `highlightedLines` only supports one visual treatment. Use `lineStates` for a per-line state map -- `"highlighted"` (same treatment as `highlightedLines`), `"focus"` (exempt from dimming, no background color), `"added"`, or `"removed"` -- so diff-style and meta-string-style decorations can share one primitive. Indices start at zero and are merged with `highlightedLines`, which is equivalent to setting `"highlighted"` here.
745
+
746
+ ```svelte
747
+ <Highlight language={typescript} {code} let:highlighted>
748
+ <LineNumbers
749
+ {highlighted}
750
+ lineStates={{ 1: "added", 2: "removed", 4: "focus" }}
751
+ />
752
+ </Highlight>
753
+ ```
754
+
755
+ Use `--line-added-background` and `--line-removed-background` to customize the background colors.
756
+
757
+ ```svelte
758
+ <Highlight language={typescript} {code} let:highlighted>
759
+ <LineNumbers
760
+ {highlighted}
761
+ lineStates={{ 1: "added", 2: "removed" }}
762
+ --line-added-background="rgba(0, 255, 0, 0.15)"
763
+ --line-removed-background="rgba(255, 0, 0, 0.15)"
764
+ />
765
+ </Highlight>
766
+ ```
767
+
620
768
  ### Custom Styles
621
769
 
622
770
  Use `--style-props` to customize styles.
623
771
 
624
- | Style prop | Description | Default value |
625
- | :----------------------- | :------------------------------------------------------ | :------------------------ |
626
- | --line-number-color | Text color of the line numbers | `currentColor` |
627
- | --border-color | Border color of the column of line numbers | `currentColor` |
628
- | --padding | Fallback padding for `--padding-left` / `--padding-right` | `1em` |
629
- | --padding-left | Left padding for `td` elements | `var(--padding, 1em)` |
630
- | --padding-right | Right padding for `td` elements | `var(--padding, 1em)` |
631
- | --highlighted-background | Background color of highlighted lines | `rgba(254, 241, 96, 0.2)` |
632
- | --unhighlighted-opacity | Opacity of un-highlighted lines (focus mode) | `1` |
633
- | --unhighlighted-filter | CSS filter for un-highlighted lines (focus mode) | `none` |
772
+ | Style prop | Description | Default value |
773
+ | :------------------------ | :------------------------------------------------------ | :-------------------------- |
774
+ | --line-number-color | Text color of the line numbers | `currentColor` |
775
+ | --line-number-digit-width | Width of a single gutter digit | `0.6em` |
776
+ | --border-color | Border color of the column of line numbers | `currentColor` |
777
+ | --padding | Fallback padding for `--padding-left` / `--padding-right` | `1em` |
778
+ | --padding-left | Left padding for `td` elements | `var(--padding, 1em)` |
779
+ | --padding-right | Right padding for `td` elements | `var(--padding, 1em)` |
780
+ | --highlighted-background | Background color of highlighted lines | `rgba(254, 241, 96, 0.2)` |
781
+ | --line-added-background | Background color of `lineStates` `"added"` lines | `rgba(46, 204, 113, 0.15)` |
782
+ | --line-removed-background | Background color of `lineStates` `"removed"` lines | `rgba(231, 76, 60, 0.15)` |
783
+ | --unhighlighted-opacity | Opacity of un-highlighted lines (focus mode) | `1` |
784
+ | --unhighlighted-filter | CSS filter for un-highlighted lines (focus mode) | `none` |
634
785
 
635
786
  See [Styling with CSS variables](#styling-with-css-variables) for the full list, including container-level variables like `--border-radius`, `--width`, and `--overflow-x`.
636
787
 
@@ -639,6 +790,7 @@ See [Styling with CSS variables](#styling-with-css-variables) for the full list,
639
790
  <LineNumbers
640
791
  {highlighted}
641
792
  --line-number-color="pink"
793
+ --line-number-digit-width="0.75em"
642
794
  --border-color="rgba(255, 255, 255, 0.2)"
643
795
  --padding-left={0}
644
796
  --padding-right="3em"
@@ -649,6 +801,8 @@ See [Styling with CSS variables](#styling-with-css-variables) for the full list,
649
801
  </Highlight>
650
802
  ```
651
803
 
804
+ The gutter's position and border use logical CSS properties (`inset-inline-start`/`inset-inline-end`), so it follows `dir="rtl"` without any extra configuration.
805
+
652
806
  ### Language Tag
653
807
 
654
808
  When using a custom slot, forward `langtag` and `languageName` from `Highlight` to `LineNumbers`.
@@ -821,8 +975,11 @@ Use `bind:code` to keep your state in sync.
821
975
 
822
976
  - **Enter** inserts a newline.
823
977
  - **Tab** / **Shift+Tab** indent or dedent the selected lines (or insert one indent at the caret). Set the indent size with the `tabSize` prop (default `2`).
978
+ - **Escape** then **Tab**/**Shift+Tab** moves keyboard focus out of the editor instead of indenting, so the block never traps focus. Any other key clears this and restores normal Tab behavior.
824
979
  - **Cmd/Ctrl+Z** undo and **Shift+Cmd/Ctrl+Z** (or **Ctrl+Y**) redo. Typing bursts collapse into a single undo step; cap the retained history with the `historyLimit` prop (default `200`).
825
980
 
981
+ Pasting and dragging content into the editor both insert plain text only, regardless of the source payload (rich text, HTML, etc.).
982
+
826
983
  ### Dispatched Events
827
984
 
828
985
  `HighlightEditable` dispatches `change` (on every edit), `blur`, and `history` (whenever the undo/redo stack changes).
@@ -869,13 +1026,28 @@ Customize the focus outline with the `--outline-color`, `--outline-width`, and `
869
1026
  />
870
1027
  ```
871
1028
 
1029
+ ### Read-only
1030
+
1031
+ Set `readonly` to keep highlighting, caret placement, and selection active while blocking edits (typing, paste, drag-and-drop, and Tab/Shift+Tab indent). The imperative API still works, so a consumer can toggle a document read-only without swapping components.
1032
+
1033
+ ```svelte
1034
+ <script>
1035
+ let readonly = false;
1036
+ </script>
1037
+
1038
+ <HighlightEditable language={typescript} bind:code {readonly} />
1039
+ <button on:click={() => (readonly = !readonly)}>
1040
+ {readonly ? "Unlock" : "Lock"}
1041
+ </button>
1042
+ ```
1043
+
872
1044
  ### Experimental: CSS Custom Highlight engine
873
1045
 
874
1046
  `engine="css-highlights"` paints tokens with the [CSS Custom Highlight API](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API) (`CSS.highlights`, `::highlight()`) instead of wrapping them in `<span>`s. The editable `<code>` stays plain text (one `<span>` per line, reused from the default engine's line structure, but with no per-token spans inside), so a repaint never replaces the DOM the caret is sitting in.
875
1047
 
876
1048
  Requires Chrome 105+, Safari 17.2+, or Firefox 140+. Where `CSS.highlights` is unavailable, `HighlightEditable` falls back to `engine="dom"` silently; check what actually ran with `editor.resolvedEngine()`.
877
1049
 
878
- Pass `theme` (the same theme string you'd give `HighlightStyle`) to generate `::highlight()` rules from it. Only `color`/`background-color` convert — `::highlight()` doesn't support `font-style`/`font-weight`/`text-decoration` across browsers, so bold/italic scopes render in plain color.
1050
+ Pass `theme` (the same theme string you'd give `HighlightStyle`) to generate `::highlight()` rules from it. Only `color`/`background-color` convert, and only for single-class `.hljs-<scope>` rules — compound (`.hljs-title.class_`) and descendant-selector (`.hljs-meta .hljs-keyword`) scopes have no `::highlight()` equivalent and get **no color at all**, not just plain weight/style.
879
1051
 
880
1052
  `theme` only covers token colors — you still need `HighlightStyle` (or an injected stylesheet) for the base `.hljs` layout rules (padding, overflow, background), exactly as with the default engine.
881
1053
 
@@ -893,6 +1065,25 @@ Pass `theme` (the same theme string you'd give `HighlightStyle`) to generate `::
893
1065
  </HighlightStyle>
894
1066
  ```
895
1067
 
1068
+ ### Adding a gutter
1069
+
1070
+ `HighlightEditable` has no slot and doesn't expose `highlighted`/`languageName`, so it can't be wrapped directly in `LineNumbers` the way a static `Highlight` block can. Mirror the same `code` in a second, read-only `Highlight` instance wrapped in `LineNumbers`, and position it alongside the editable block:
1071
+
1072
+ ```svelte
1073
+ <script>
1074
+ import { Highlight, HighlightEditable, LineNumbers } from "svelte-highlight";
1075
+ import typescript from "svelte-highlight/languages/typescript";
1076
+
1077
+ let code = "const add = (a: number, b: number) => a + b";
1078
+ </script>
1079
+
1080
+ <HighlightEditable language={typescript} bind:code />
1081
+
1082
+ <Highlight language={typescript} {code} let:highlighted let:languageName>
1083
+ <LineNumbers {highlighted} {languageName} />
1084
+ </Highlight>
1085
+ ```
1086
+
896
1087
  ## Language Targeting
897
1088
 
898
1089
  All `Highlight` components apply a `data-language` attribute on the codeblock containing the language name.
@@ -907,10 +1098,16 @@ See [SUPPORTED_LANGUAGES.md](SUPPORTED_LANGUAGES.md) for a list of supported lan
907
1098
 
908
1099
  ## Language Tags
909
1100
 
1101
+ The language tag is one badge (`LangTag.svelte` + `langtag.css`) reached three ways: automatically, via `Highlight`/`HighlightAuto`/`HighlightSvelte`'s built-in fallback render when `langtag` is set; directly, via the standalone `LangTag` component; or via `LineNumbers`' own `langtag`/`languageName` props, which are not wired to a wrapping `Highlight` automatically and must be forwarded manually from slot props (see [Language Tag](#language-tag) under Line Numbers).
1102
+
910
1103
  Set `langtag` to `true` to display the language name in the top right corner of the code block.
911
1104
 
912
1105
  Customize the language tag `background`, `color`, and `border-radius` using style props.
913
1106
 
1107
+ Setting `langtag` opts a `<Highlight>` usage out of the [`svelte-highlight/static`](#static-mode) build-time transform, since static output can't pull in `langtag.css`.
1108
+
1109
+ If the highlighted output is empty (e.g. empty `code`, or code that highlights to an empty string), the badge and code block still render, but the code falls back to plain, unhighlighted text — the `hljs` class is still applied, there's just no syntax-highlighting markup inside it.
1110
+
914
1111
  See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languages.
915
1112
 
916
1113
  | Style prop | Description | Default value |
@@ -921,6 +1118,7 @@ See the [Languages page](SUPPORTED_LANGUAGES.md) for a list of supported languag
921
1118
  | --langtag-color | Text color of the langtag | `inherit` |
922
1119
  | --langtag-border-radius | Border radius of the langtag | `0` |
923
1120
  | --langtag-padding | Padding of the langtag | `1em` |
1121
+ | --langtag-font-size | Font size of the langtag | `inherit` |
924
1122
 
925
1123
  ```svelte
926
1124
  <script>
@@ -954,37 +1152,80 @@ The easiest way to author one is with `svelte-highlight/compat`'s `fromHighlight
954
1152
  import { Highlight } from "svelte-highlight";
955
1153
  import { fromHighlightJs } from "svelte-highlight/compat";
956
1154
 
957
- function defineCustomLanguage(hljs) {
1155
+ function defineDotenv(hljs) {
958
1156
  return {
959
- /** custom language rules */
960
- contains: [],
1157
+ name: "dotenv",
1158
+ contains: [
1159
+ hljs.HASH_COMMENT_MODE,
1160
+ { className: "keyword", begin: /^[ \t]*export(?=[ \t])/ },
1161
+ { className: "attr", begin: /[A-Za-z_][A-Za-z0-9_]*(?=[ \t]*=)/ },
1162
+ {
1163
+ className: "string",
1164
+ variants: [
1165
+ { begin: /"/, end: /"/, contains: [hljs.BACKSLASH_ESCAPE] },
1166
+ { begin: /'/, end: /'/ },
1167
+ ],
1168
+ },
1169
+ ],
961
1170
  };
962
1171
  }
963
1172
 
964
- const languagePromise = fromHighlightJs("custom-language", defineCustomLanguage);
1173
+ const languagePromise = fromHighlightJs("dotenv", defineDotenv);
965
1174
  </script>
966
1175
 
967
1176
  {#await languagePromise then language}
968
- <Highlight {language} code="..." />
1177
+ <Highlight {language} code={'PORT=3000\n# comment'} />
969
1178
  {/await}
970
1179
  ```
971
1180
 
972
1181
  `fromHighlightJs` needs `highlight.js` itself, which svelte-highlight does not bundle — install it as your own dependency (`npm install highlight.js`). It's only imported the first time you call `fromHighlightJs`, so pages that never use it don't pay for it.
973
1182
 
1183
+ `fromHighlightJs` also accepts an optional third `source` argument (raw source text, e.g. via a bundler's `?raw` import) to recover array-membership `on:begin` guards the compiled callback alone can't expose, and the returned object carries a `warnings: string[]` field (empty when clean) so you can detect a degraded conversion without reading the console.
1184
+
1185
+ ```ts
1186
+ const language = await fromHighlightJs("dotenv", defineDotenv, grammarSourceText);
1187
+ if (language.warnings.length > 0) {
1188
+ console.error("dotenv degraded:", language.warnings);
1189
+ }
1190
+ ```
1191
+
974
1192
  If you're using TypeScript, use the `LanguageType` interface to type the language.
975
1193
 
976
1194
  ```ts
977
1195
  import type { LanguageType } from "svelte-highlight";
978
1196
  import { fromHighlightJs } from "svelte-highlight/compat";
979
1197
 
980
- const language: LanguageType<"custom-language"> = await fromHighlightJs(
981
- "custom-language",
982
- (hljs) => ({ contains: [] }),
1198
+ const language: LanguageType<"dotenv"> = await fromHighlightJs(
1199
+ "dotenv",
1200
+ (hljs) => ({
1201
+ name: "dotenv",
1202
+ contains: [
1203
+ hljs.HASH_COMMENT_MODE,
1204
+ { className: "attr", begin: /[A-Za-z_][A-Za-z0-9_]*(?=[ \t]*=)/ },
1205
+ ],
1206
+ }),
983
1207
  );
984
1208
  ```
985
1209
 
986
1210
  Building a package for others to install? Ship the converted grammar directly instead of calling `fromHighlightJs` at runtime — see [`scripts/convert-grammars.ts`](scripts/convert-grammars.ts) for the converter this package's own bundled languages go through.
987
1211
 
1212
+ ### Conversion fidelity
1213
+
1214
+ `fromHighlightJs` and [`scripts/convert-grammars.ts`](scripts/convert-grammars.ts) (the pipeline behind every one of the ~244 bundled `svelte-highlight/languages/*` grammars) share the exact same converter, so a custom grammar goes through identical logic to every shipped one, not a lesser path.
1215
+
1216
+ Most hljs grammars are plain-JSON `contains`/`begin`/`end`/`className` rules, which convert as-is. A grammar can also use `on:begin`, `on:end`, or `__beforeBegin` callbacks for cases regexes alone can't express; the converter recognizes six specific shapes and turns them into declarative flags:
1217
+
1218
+ - An `on:begin` callback that copies the matched text so the closing delimiter must equal the opening one (heredocs).
1219
+ - An `on:begin` callback that only accepts a match at the very start of input (a shebang guard).
1220
+ - An `on:begin` callback that disambiguates an opening tag from a generic comparison (JSX).
1221
+ - An `on:begin` callback that checks the character immediately before the match (a letter-boundary guard).
1222
+ - An `on:begin` callback checking `SOME_SET.has(match[0])` against a module-level word list — recovered only when you also pass the grammar's own source text as `fromHighlightJs`'s third argument, since the compiled callback alone doesn't expose the backing array.
1223
+ - A `__beforeBegin` callback that rejects a match immediately following a `.` (hljs's `beginKeywords` dot-guard).
1224
+
1225
+ Any other `on:begin`/`on:end`/`__beforeBegin` body converts too, but with a `console.warn` and the rule's relevance forced to zero — it still matches, unconditionally, without skewing auto-detection. Check `language.warnings` (see above) to catch this without reading the console.
1226
+
1227
+ Upgrading a custom language written before 7.16? Before 7.16, a custom language was `{ name, register: (hljs) => modeObject }` passed synchronously straight to `<Highlight>`'s `language` prop. Since 7.16 replaced the highlight.js runtime with this package's own engine, `register` must be plain-JSON grammar IR instead, and `fromHighlightJs` (now async, requiring `{#await}`) is the replacement shown above.
1228
+
988
1229
  ## Custom Plugin
989
1230
 
990
1231
  Third-party hljs language plugins work the same way: pass their `register(hljs)` export to `fromHighlightJs`.
@@ -1046,6 +1287,8 @@ In the example below, the `HighlightAuto` component and injected styles are dyna
1046
1287
  />
1047
1288
  ```
1048
1289
 
1290
+ Registering a grammar checks its canonical name, not an alias lookup, before skipping — so a grammar that aliases another (highlight.js's "ini" aliases "toml") can't make the real grammar look already-registered before it has actually loaded.
1291
+
1049
1292
  ### Loading a language by name
1050
1293
 
1051
1294
  The example above imports a specific language as a static string, which lets the bundler split out only the grammars you reference. When the language is known only at **runtime** — a Markdown fence (` ```ts `), an API field, or a user-selected value — use the `loadLanguage` helper to import a grammar by name:
@@ -1071,22 +1314,28 @@ The example above imports a specific language as a static string, which lets the
1071
1314
  {/await}
1072
1315
  ```
1073
1316
 
1074
- `loadLanguage` accepts a [supported language name](SUPPORTED_LANGUAGES.md), dynamically imports its grammar, and resolves with the language object. It rejects with an `Unknown language` error for an unrecognized name, so handle the `{:catch}` block (or `.catch`) when the name comes from untrusted input.
1075
-
1076
- > **Note:** Because the imported name is dynamic, the bundler cannot prune unused grammars and will emit a chunk for every language. Prefer a static `import` when the language is known ahead of time, and reach for `loadLanguage` only when it is not.
1077
-
1078
- A practical case is rendering Markdown, where each fenced block declares its own language:
1317
+ `loadLanguage` accepts a [supported language name](SUPPORTED_LANGUAGES.md), dynamically imports its grammar, and resolves with the language object. It rejects with a `LanguageLoadError` for an unrecognized name, so handle the `{:catch}` block (or `.catch`) when the name comes from untrusted input. `LanguageLoadError` is importable from `svelte-highlight` for an `instanceof` check:
1079
1318
 
1080
1319
  ```js
1081
- import { loadLanguage } from "svelte-highlight";
1320
+ import { LanguageLoadError } from "svelte-highlight";
1082
1321
 
1083
- // e.g. from a Markdown fence: ```ts → "typescript"
1084
- async function highlightFence(fenceLang, code) {
1085
- const grammar = await loadLanguage(fenceLang);
1086
- return { code, language: grammar };
1322
+ try {
1323
+ const grammar = await loadLanguage(name);
1324
+ } catch (error) {
1325
+ if (error instanceof LanguageLoadError) {
1326
+ // handle a missing/misspelled language name
1327
+ }
1087
1328
  }
1088
1329
  ```
1089
1330
 
1331
+ Grammars with embedded sublanguages (`astro`, `svelte`, and others with a `dependencies` list) register their dependencies automatically — `Highlight`, `HighlightAuto`, and `HighlightSvelte` all call `ensureRegistered` on the language they're given, which registers the grammar and recurses through its dependencies.
1332
+
1333
+ `loadLanguage` does a fresh `import()` on every call and keeps no explicit cache, but it's safe to call repeatedly for the same name: module loaders dedupe dynamic imports by resolved specifier rather than re-fetching, so repeated calls resolve to the same cached module.
1334
+
1335
+ > **Note:** Because the imported name is dynamic, the bundler cannot prune unused grammars and will emit a chunk for every language — all 279 shipped grammars. Prefer a static `import` when the language is known ahead of time, and reach for `loadLanguage` only when it is not.
1336
+
1337
+ A practical case is rendering Markdown, where each fenced block declares its own language — see "[Rendering Markdown/MDX fences](#rendering-markdownmdx-fences)" below for a ready-made `highlightFence` helper built on top of `loadLanguage`.
1338
+
1090
1339
  ## Static mode
1091
1340
 
1092
1341
  `svelte-highlight/static` is a Svelte preprocessor. At build time it replaces `<Highlight>` usages that have known `code` and `language` with pre-rendered `highlight.js` HTML, so the client never downloads `highlight.js` or that grammar module.
@@ -1125,7 +1374,7 @@ The static transform runs only when all of these are true:
1125
1374
  - `language` is a plain identifier from a static `import` of `svelte-highlight/languages/*`.
1126
1375
  - `code` is a string literal or a template literal with no `${...}` interpolation.
1127
1376
  - The element has no slot content, spread props, or directives (`bind:`, `on:`, etc.).
1128
- - `langtag` is not set. Static output can't pull in `langtag.css`; that only happens when a runtime `LangTag` is in the bundle.
1377
+ - `langtag`, if set, is a bare flag or a static boolean literal (`langtag={true}`/`langtag={false}`) - not a variable or expression. Static output can't pull in `langtag.css` (that only happens when a runtime `LangTag` is in the bundle), so a truthy `langtag` renders the language badge as a plain inline-styled `<span>` instead, themed with the same `--langtag-*` custom properties `LangTag` reads - customization is limited to those variables, not `LangTag`'s slot content.
1129
1378
 
1130
1379
  Dynamic `code` or `language`, `loadLanguage`, `HighlightAuto`, `HighlightSvelte`, and `HighlightEditable` keep the runtime component. No warning. That's intentional.
1131
1380
 
@@ -1139,7 +1388,102 @@ highlightStatic({
1139
1388
  });
1140
1389
  ```
1141
1390
 
1142
- Scope is small on purpose. Extra props on `<Highlight>` don't carry over to the emitted `<pre>`. Unused `Highlight` and language imports are left in place; bundlers drop them (`sideEffects` in `package.json` is narrow enough). No Astro/MDX fence hook yet.
1391
+ To measure how many `<Highlight>` usages a build actually converted to static markup, pass `onSummary`. It fires once per file with at least one shape-matched usage (files with none don't trigger it), so summing across calls gives a build-wide total:
1392
+
1393
+ ```js
1394
+ let matched = 0;
1395
+ let succeeded = 0;
1396
+
1397
+ highlightStatic({
1398
+ onSummary(summary) {
1399
+ matched += summary.matched;
1400
+ succeeded += summary.succeeded;
1401
+ },
1402
+ });
1403
+ ```
1404
+
1405
+ Scope is small on purpose. Extra props on `<Highlight>` don't carry over to the emitted `<pre>`. Unused `Highlight` and language imports are left in place; bundlers drop them (`sideEffects` in `package.json` is narrow enough).
1406
+
1407
+ ### Rendering Markdown/MDX fences
1408
+
1409
+ `highlightStatic` only transforms literal `<Highlight>` usages in `.svelte` files. Markdown/MDX/mdsvex code fences never go through the Svelte compiler at all, so `svelte-highlight/fence` provides a separate, framework-agnostic building block: `parseMeta(meta)` and `highlightFence({ code, lang, meta })`, a plain async function with zero Svelte dependency.
1410
+
1411
+ ```js
1412
+ import { highlightFence } from "svelte-highlight/fence";
1413
+
1414
+ const html = await highlightFence({
1415
+ code: 'const add = (a, b) => a + b;\nconst sub = (a, b) => a - b;\nexport { add, sub };',
1416
+ lang: "typescript",
1417
+ meta: '{1,3-5} title="app.ts"',
1418
+ });
1419
+ ```
1420
+
1421
+ `lang` must be the grammar's canonical file name (see "[Loading a language by name](#loading-a-language-by-name)"); it rejects with `LanguageLoadError` for an unrecognized one. `meta` is the Expressive Code/Shiki-style vocabulary standardized on by tools like Astro, Starlight, and rehype-pretty-code: a bare `{1,3-5}` or `mark={1,3-5}` marks lines, `ins={...}`/`del={...}` mark insertions/deletions, `title="..."` sets a title, and `showLineNumbers` is a bare flag. The output wraps each line in `<span class="line" data-line-state="mark|ins|del">` (only when a state applies) inside a `<pre class="hljs" data-language="...">`, so a `mark`/`ins`/`del`-aware stylesheet can target `[data-line-state]` the same way it would target Expressive Code or Shiki output.
1422
+
1423
+ **mdsvex.** Wire `highlightFence` into `highlight.highlighter`, whose signature is `(code, lang, meta) => string | Promise<string>`:
1424
+
1425
+ ```js
1426
+ // mdsvex.config.js
1427
+ import { highlightFence } from "svelte-highlight/fence";
1428
+
1429
+ /** @type {import("mdsvex").MdsvexOptions} */
1430
+ const config = {
1431
+ highlight: {
1432
+ highlighter: (code, lang, meta) => highlightFence({ code, lang, meta }),
1433
+ },
1434
+ };
1435
+
1436
+ export default config;
1437
+ ```
1438
+
1439
+ **markdown-it.** Wire it into the `highlight` constructor option, whose signature is `(str, lang, attrs) => string` — markdown-it inserts the returned string verbatim (no further escaping), and `highlight` isn't allowed to be `async`, so pre-render fences you know about or fall back to a sync path for the rest:
1440
+
1441
+ ```js
1442
+ import MarkdownIt from "markdown-it";
1443
+ import { highlightFence } from "svelte-highlight/fence";
1444
+
1445
+ const md = new MarkdownIt({
1446
+ highlight(str, lang, attrs) {
1447
+ // highlightFence is async; markdown-it's highlight isn't, so either
1448
+ // pre-highlight fences in a separate async pass before render() and
1449
+ // look the result up here, or fall back to escaped plain text.
1450
+ return md.utils.escapeHtml(str);
1451
+ },
1452
+ });
1453
+ ```
1454
+
1455
+ **rehype.** `rehype`/`unist-util-visit` are the consumer's dependencies, not this package's. A rehype plugin walks the hast tree *after* `remark-rehype` has already converted fenced code to `<pre><code class="language-*">` — the fence's `meta` string isn't part of that hast by default, only `lang` (via the `language-*` class), so pass `meta` through only if an earlier remark step attached it (e.g. `node.data.hProperties["data-meta"] = mdastNode.meta`):
1456
+
1457
+ ```js
1458
+ import { visit } from "unist-util-visit";
1459
+ import { highlightFence } from "svelte-highlight/fence";
1460
+
1461
+ function rehypeHighlightFence() {
1462
+ return async (tree) => {
1463
+ const nodes = [];
1464
+ visit(tree, "element", (node, index, parent) => {
1465
+ if (node.tagName !== "pre" || parent === undefined || index === undefined) return;
1466
+ const code = node.children.find((child) => child.tagName === "code");
1467
+ if (code) nodes.push({ node, index, parent, code });
1468
+ });
1469
+
1470
+ for (const { node, index, parent, code } of nodes) {
1471
+ const lang = code.properties?.className
1472
+ ?.map(String)
1473
+ .find((c) => c.startsWith("language-"))
1474
+ ?.slice("language-".length);
1475
+ if (!lang) continue;
1476
+
1477
+ const html = await highlightFence({
1478
+ code: code.children.map((c) => (c.type === "text" ? c.value : "")).join(""),
1479
+ lang,
1480
+ meta: code.properties?.["data-meta"],
1481
+ });
1482
+ parent.children[index] = { type: "raw", value: html };
1483
+ }
1484
+ };
1485
+ }
1486
+ ```
1143
1487
 
1144
1488
  ## Action
1145
1489
 
@@ -1347,6 +1691,29 @@ Control the pacing curve with `easing`: a function mapping elapsed-time fraction
1347
1691
 
1348
1692
  Named curves: `linear` (default), `easeInQuad`/`easeOutQuad`/`easeInOutQuad`, `easeInCubic`/`easeOutCubic`/`easeInOutCubic`, `easeInSine`/`easeOutSine`/`easeInOutSine`.
1349
1693
 
1694
+ Set `speed={0}` to reveal all content on the very first frame -- a documented "skip typing" escape hatch, useful for a "skip" button or for finishing an off-screen instance instantly.
1695
+
1696
+ By default `granularity="char"` reveals one character at a time. Set `granularity="word"` to reveal a full word per step instead -- a ChatGPT-style token-by-token reveal. Total typing duration and `easing` are unaffected either way; only which character counts `revealed` may land on changes.
1697
+
1698
+ ```svelte
1699
+ <Highlight language={typescript} {code} let:highlighted>
1700
+ <Typewriter {highlighted} granularity="word" />
1701
+ </Highlight>
1702
+ ```
1703
+
1704
+ Fire `on:progress` for a progress bar or "X% typed" indicator -- it dispatches `{ revealed, total }` (visible-character counts) whenever `revealed` advances. `revealed` and `total` are also exposed for `bind:revealed`/`bind:total`, though both are read-only in practice: the component overwrites them every frame.
1705
+
1706
+ ```svelte
1707
+ <Highlight language={typescript} {code} let:highlighted>
1708
+ <Typewriter
1709
+ {highlighted}
1710
+ bind:revealed
1711
+ bind:total
1712
+ on:progress={(e) => console.log(`${e.detail.revealed}/${e.detail.total}`)}
1713
+ />
1714
+ </Highlight>
1715
+ ```
1716
+
1350
1717
  `Typewriter` doesn't gate itself on `prefers-reduced-motion` -- if you want to honor it, check `matchMedia("(prefers-reduced-motion: reduce)")` yourself and skip rendering `Typewriter` (or set a very low `speed`). Customize the caret with `--caret-width`, `--caret-height`, `--caret-gap`, `--caret-color`, and `--caret-blink`.
1351
1718
 
1352
1719
 
@@ -1386,8 +1753,12 @@ Append to `code` as chunks come in; set `done` once the stream ends.
1386
1753
 
1387
1754
  Multiple chunks appended within the same animation frame coalesce into a single highlight pass. Already-rendered lines are diffed and left untouched in the DOM; only lines whose content actually changed are repainted, so a fast-scrolling response only touches its changed suffix (typically the last line). A multi-line construct left open mid-stream -- an unterminated template literal or block comment -- re-tokenizes the lines it spans once the closing delimiter arrives, with no special-casing needed: it falls out of re-highlighting the full buffer on every update.
1388
1755
 
1756
+ `code` doesn't have to only grow by appending -- an edit to already-streamed text (an LLM regenerating an earlier paragraph, say) is handled incrementally too, via `StreamSession#replace()` under the hood, instead of discarding the session and re-tokenizing the whole buffer from scratch.
1757
+
1389
1758
  A blinking caret marks the end of output while `!done`; setting `done` hides it and performs one final full highlight, so the finished output matches what `Highlight` would render for the same code. `on:done` fires right after that final highlight. Customize the caret with the same `--caret-width`, `--caret-height`, `--caret-gap`, `--caret-color`, and `--caret-blink` variables as `Typewriter`.
1390
1759
 
1760
+ A blinking caret is a purely visual cue, so the root element also carries `aria-busy` while `!done`, and a visually-hidden, polite live region announces `doneText` (default `"Code finished streaming"`) once `done` flips to `true` -- screen reader users get the same "still streaming" / "finished" signal sighted users get from the caret. Set `doneText` to `""` to disable the announcement.
1761
+
1391
1762
  Set `autoScroll` to keep the container pinned to the bottom as output grows -- it stops auto-scrolling as soon as you scroll up, and resumes once you scroll back to the bottom.
1392
1763
 
1393
1764
  ```svelte
@@ -1400,7 +1771,7 @@ Per-chunk work is O(tail), not O(stream length so far): finished output is seale
1400
1771
  <HighlightStream language={typescript} {code} {done} virtualize style="height: 20em;" />
1401
1772
  ```
1402
1773
 
1403
- `virtualize` renders only the lines within the scrolled viewport (plus `overscan`), the same windowing `HighlightVirtual` does for static documents -- a stream that runs to tens of thousands of lines still costs a couple dozen DOM nodes. It swaps the sealed-chunk session for `TokenizedDocument` (see [Large documents](#large-documents) below), so output always reflects the streaming (non-canonicalized) parse, even once `done` -- unlike the default mode, which upgrades to a canonical final render. `on:highlight` isn't dispatched in this mode, since materializing the full HTML on every repaint would defeat the point of windowing; `on:done`, the caret, and `autoScroll` all keep working.
1774
+ `virtualize` renders only the lines within the scrolled viewport (plus `overscan`), the same windowing `HighlightVirtual` does for static documents -- a stream that runs to tens of thousands of lines still costs a couple dozen DOM nodes. It swaps the sealed-chunk session for `TokenizedDocument` (see [Large documents](#large-documents) below), so output always reflects the streaming (non-canonicalized) parse, even once `done` -- unlike the default mode, which upgrades to a canonical final render. `on:highlight` isn't dispatched in this mode, since materializing the full HTML on every repaint would defeat the point of windowing; `on:done`, the caret, and `autoScroll` all keep working. `on:windowchange` fires with `{ start, end, lineCount }` whenever the rendered window moves, so you can show something like "lines *N*-*M* of *T*" without counting DOM nodes yourself. Row math assumes one line per fixed-height row, so `virtualize` can't wrap lines -- it always renders with `white-space: pre`, overriding any `white-space` you pass through `$$restProps`.
1404
1775
 
1405
1776
  ## Large documents
1406
1777
 
@@ -1420,7 +1791,9 @@ Per-chunk work is O(tail), not O(stream length so far): finished output is seale
1420
1791
  <HighlightVirtual language={json} code={hugeLogDump} style="height: 480px" />
1421
1792
  ```
1422
1793
 
1423
- The rendered `<pre>` is the scroll container itself -- size it with `style`/`class`/`$$restProps`, same as `Highlight`. Content doesn't wrap (uniform line height is a v1 constraint, measured once from a rendered probe line). `overscan` (default `12`) controls how many extra lines render above/below the viewport; `checkpointInterval` (default `100`) controls how often the engine snapshots its parse state, trading a little memory for cheaper random access. Server-rendered output is the full document as plain escaped text (predictable cost for huge documents); the windowed, highlighted view takes over after hydration.
1794
+ The rendered `<pre>` is the scroll container itself -- size it with `style`/`class`/`$$restProps`, same as `Highlight`, but `white-space` can't be overridden this way: it's pinned to `pre` because the windowing math depends on a uniform line height. Content doesn't wrap (uniform line height is a v1 constraint, measured once from a rendered probe line). `overscan` (default `12`) controls how many extra lines render above/below the viewport; `checkpointInterval` (default `100`) controls how often the engine snapshots its parse state, trading a little memory for cheaper random access. Concretely, memory scales with `document lines / checkpointInterval` retained checkpoints, each holding a full engine snapshot plus open-scope/pending-HTML state -- and checkpoints are never evicted: they're retained for the entire lifetime of the `TokenizedDocument` instance, across any number of `append()` calls, until a `setCode()` call with unrelated content triggers a full reset. This is fine for the target "huge static document" use case, since checkpoints are bounded by that one document's size, but worth knowing for a long-lived instance that's repeatedly `setCode()`-reset with genuinely new documents rather than recreated. A consumer worried about retained memory can call `doc.checkpointCount()` directly rather than estimating it from `lineCount()`/`checkpointInterval`. Server-rendered output is the full document as plain escaped text (predictable cost for huge documents); the windowed, highlighted view takes over after hydration. In practice this means every page load flashes from unstyled monochrome text to highlighted, windowed content right after hydration, with no fade -- unlike `HighlightStream`'s default (non-`virtualize`) mode, which SSRs already-highlighted HTML. Nothing here requires a component change to soften today: since the container already needs an explicit size (`style`/`class`/`$$restProps`, above), reserving that same `min-height`/`height` up front prevents layout shift, and a CSS transition keyed off a `data-hydrated` attribute or class toggle you set yourself -- e.g. in `onMount` on a wrapping element -- can fade the flash instead of leaving it instant.
1795
+
1796
+ `on:windowchange` fires with `{ start, end, lineCount }` whenever the rendered window moves, so you can show something like "lines *N*-*M* of *T*" without counting DOM nodes yourself. `bind:this`, then call `scrollToLine(line)` to scroll a given line into view -- useful for a "jump to line" control -- without guessing at the line height yourself.
1424
1797
 
1425
1798
  For custom virtualization, servers, or tests, `svelte-highlight/tokenized-document` exposes the same windowing primitive headlessly:
1426
1799
 
@@ -1435,7 +1808,54 @@ doc.lineRange(50_000, 50_040); // 40 highlighted lines in O(window + interval)
1435
1808
  doc.append(moreCode); // streaming growth, no re-tokenization
1436
1809
  ```
1437
1810
 
1438
- `lineRange` tokenizes lazily and caches the most recently resolved window, so scrolling through even a huge document only ever pays for the lines actually requested. Its output matches `HighlightStream`'s live (non-canonicalized) parse: constructs needing multi-line lookahead across a window's edge can render slightly differently than `registry.highlight()`'s canonical output, the same tradeoff streaming already makes. `TokenizedDocument` doesn't support mid-document edits -- `append` and full `setCode` resets only.
1811
+ `Typewriter`'s tokenizer is available the same way, for a custom reveal UI or non-DOM use: `svelte-highlight/typewriter-units` exposes `tokenizeTypewriter`, `buildUnitMarkup`, `createTypewriterSplitter`, and `computeWordBoundaries` headlessly.
1812
+
1813
+ ```js
1814
+ import {
1815
+ computeWordBoundaries,
1816
+ tokenizeTypewriter,
1817
+ } from "svelte-highlight/typewriter-units";
1818
+
1819
+ const units = tokenizeTypewriter(highlighted);
1820
+ const wordBoundaries = computeWordBoundaries(units); // for word-by-word reveal
1821
+ ```
1822
+
1823
+ `lineRange` tokenizes lazily and caches the most recently resolved window, so scrolling through even a huge document only ever pays for the lines actually requested. Its output matches `HighlightStream`'s live (non-canonicalized) parse: constructs needing multi-line lookahead across a window's edge can render slightly differently than `registry.highlight()`'s canonical output, the same tradeoff streaming already makes. `TokenizedDocument` doesn't support mid-document edits -- `append` and full `setCode` resets only. For a bounded, editable document (not a windowed/virtualized one), `HighlightEditable` solves mid-document editing, built on its own checkpoint-resume re-tokenizer (`src/incremental-tokenize.js`, not itself a public export). The two aren't unified today -- there's no single primitive yet for a document that's both editable and virtualized.
1824
+
1825
+ ### Without virtualization
1826
+
1827
+ For documents in the low thousands to tens of thousands of lines (roughly 2,000-20,000), `HighlightVirtual`'s hard constraints -- no wrapping, an SSR-to-hydration flash, a fixed-height v1 container -- may not be worth taking on. The CSS [`content-visibility: auto`](https://developer.mozilla.org/en-US/docs/Web/CSS/content-visibility) property gets you a native-scrolling, cheap-to-render alternative built entirely from already-public APIs, at the cost of the DOM-node count `HighlightVirtual` avoids:
1828
+
1829
+ ```svelte
1830
+ <script>
1831
+ import { createRegistry, registerAll, tokenLines } from "svelte-highlight/engine";
1832
+ import typescript from "svelte-highlight/languages/typescript";
1833
+
1834
+ const registry = createRegistry();
1835
+ registerAll(registry, typescript);
1836
+
1837
+ export let code;
1838
+ const { events } = registry.highlight(code, { language: "typescript" });
1839
+ const lines = tokenLines(events); // [[{ text, scopes }, …], …]
1840
+
1841
+ function scopeClass(scope) {
1842
+ return scope
1843
+ .split(".")
1844
+ .map((piece) => `hljs-${piece}`)
1845
+ .join(" ");
1846
+ }
1847
+ </script>
1848
+
1849
+ <div class="hljs" style="content-visibility: auto; contain-intrinsic-size: auto 1000px;">
1850
+ {#each lines as line}
1851
+ <div style="white-space: pre; content-visibility: auto; contain-intrinsic-size: auto 20px;">
1852
+ {#each line as token}<span class={token.scopes.map(scopeClass).join(" ")}>{token.text}</span>{/each}
1853
+ </div>
1854
+ {/each}
1855
+ </div>
1856
+ ```
1857
+
1858
+ Each line is its own block-level `<div>`, not a row in a `<table>`/`<tr>` (the way `LineNumbers` renders) -- `content-visibility` doesn't apply to table-internal display types, so off-screen table rows never get the skip. Off-screen `<div>` lines do: the browser skips layout/paint/style for them, using `contain-intrinsic-size` as a placeholder size until they scroll near the viewport. Unlike `HighlightVirtual`, this is a progressive enhancement, not a hard requirement -- browsers without `content-visibility` support just render every line normally, and you get native text selection, find-in-page, and line wrapping for free (drop the `white-space: pre` on each line's `<div>` to allow it).
1439
1859
 
1440
1860
  ## Terminal Output
1441
1861
 
@@ -1452,7 +1872,7 @@ Use `AnsiOutput` to render terminal output that still contains ANSI [SGR](https:
1452
1872
  <AnsiOutput {text} />
1453
1873
  ```
1454
1874
 
1455
- Malformed or unsupported escape sequences are dropped. Nothing throws.
1875
+ Malformed or unsupported escape sequences are dropped. Nothing throws. OSC 8 hyperlinks only render as links for `http:`, `https:`, and `mailto:` URIs; any other scheme renders as plain text. `parseAnsi` is one-shot and drops a trailing unterminated sequence, so for streamed output accumulate the full text and re-parse it rather than calling it once per chunk.
1456
1876
 
1457
1877
  ### Theming the palette
1458
1878
 
@@ -1477,6 +1897,14 @@ With `autoContrast` on (the default), spans that set a background get a readable
1477
1897
  <AnsiOutput {text} autoContrast={false} />
1478
1898
  ```
1479
1899
 
1900
+ ### Wrapping long lines
1901
+
1902
+ `AnsiOutput` never wraps by default -- long lines scroll horizontally. Set `wrap` to wrap them instead:
1903
+
1904
+ ```svelte
1905
+ <AnsiOutput {text} wrap />
1906
+ ```
1907
+
1480
1908
  ### Pairing with `CodeWindow`
1481
1909
 
1482
1910
  Put `AnsiOutput` inside `CodeWindow variant="terminal"` for the prompt and title bar:
@@ -1540,6 +1968,12 @@ Arrow keys move between tabs; `Home` and `End` jump to the first and last. The m
1540
1968
  </FileTabs>
1541
1969
  ```
1542
1970
 
1971
+ `active` is reconciled whenever `files` changes: an unknown or stale value (including a `bind:active` set before `files` loads) falls back to `files[0]`; removing the active file selects its former neighbor (same index, clamped to the new length), like closing a tab in an editor; an empty `files` array sets `active` to `undefined` and the tab panel omits `aria-labelledby`. `on:change` fires once whenever this reconciliation actually changes `active`.
1972
+
1973
+ When the tab strip overflows, its overflowing edge fades to signal there's more to scroll to; changing `active` (by click, keyboard, or `bind:active`) scrolls that tab into view.
1974
+
1975
+ The active tab's `--tab-active-color` and `--tab-active-background` are resolved from the highlighted code's computed style after mount, so they render as `inherit`/`transparent` on first paint; for an SSR-critical, above-the-fold tab strip, set `--tab-active-background` and `--tab-active-color` yourself to avoid a flash before hydration.
1976
+
1543
1977
  ## Component API
1544
1978
 
1545
1979
  ### `Highlight`
@@ -1551,12 +1985,13 @@ Arrow keys move between tabs; `Home` and `End` jump to the first and last. The m
1551
1985
  | code | `any` | N/A (required) |
1552
1986
  | language | { name: `string`; register: `object` } | N/A (required) |
1553
1987
  | langtag | `boolean` | `false` |
1988
+ | wrap | `boolean` | `false` |
1554
1989
 
1555
1990
  `$$restProps` are forwarded to the top-level `pre` element.
1556
1991
 
1557
1992
  #### Dispatched Events
1558
1993
 
1559
- - **on:highlight**: fired after `code` is highlighted
1994
+ - **on:highlight**: fired after `code` is highlighted, once per change (not on unrelated re-renders), including when the result is empty (empty `code`)
1560
1995
 
1561
1996
  ```svelte
1562
1997
  <Highlight
@@ -1579,19 +2014,37 @@ Arrow keys move between tabs; `Home` and `End` jump to the first and last. The m
1579
2014
  />
1580
2015
  ```
1581
2016
 
2017
+ ### `HighlightStyle`
2018
+
2019
+ #### Props
2020
+
2021
+ | Name | Type | Default value |
2022
+ | :--------- | :---------------------- | :------------------------ |
2023
+ | theme | `string \| ThemePalette` | N/A |
2024
+ | light | `string \| ThemePalette` | N/A |
2025
+ | dark | `string \| ThemePalette` | N/A |
2026
+ | mode | `"auto" \| "light" \| "dark" \| string` | `"auto"` |
2027
+ | scopeClass | `string` | hash of `theme` |
2028
+ | nonce | `string` | N/A |
2029
+
2030
+ The default slot exposes `{ scopeClass }`. `$$restProps` are forwarded to the top-level `div` element.
2031
+
1582
2032
  ### `LineNumbers`
1583
2033
 
1584
2034
  #### Props
1585
2035
 
1586
- | Name | Type | Default value |
1587
- | :----------------- | :--------- | :------------- |
1588
- | highlighted | `string` | N/A (required) |
1589
- | hideBorder | `boolean` | `false` |
1590
- | wrapLines | `boolean` | `false` |
1591
- | startingLineNumber | `number` | `1` |
1592
- | highlightedLines | `number[]` | `[]` |
1593
- | langtag | `boolean` | `false` |
1594
- | languageName | `string` | `"plaintext"` |
2036
+ | Name | Type | Default value |
2037
+ | :----------------- | :---------------------------------------------------------- | :----------------------------------- |
2038
+ | highlighted | `string` | N/A (required unless `lines` is set) |
2039
+ | lines | `string[]` | `undefined` |
2040
+ | lineCount | `number` | `undefined` |
2041
+ | hideBorder | `boolean` | `false` |
2042
+ | wrapLines | `boolean` | `false` |
2043
+ | startingLineNumber | `number` | `1` |
2044
+ | highlightedLines | `number[]` | `[]` |
2045
+ | lineStates | `Record<number, "highlighted" \| "focus" \| "added" \| "removed">` | `{}` |
2046
+ | langtag | `boolean` | `false` |
2047
+ | languageName | `string` | `"plaintext"` |
1595
2048
 
1596
2049
  `$$restProps` are forwarded to the top-level `div` element.
1597
2050
 
@@ -1642,6 +2095,7 @@ Arrow keys move between tabs; `Home` and `End` jump to the first and last. The m
1642
2095
  | :----------- | :-------- | :------------- |
1643
2096
  | text | `string` | N/A (required) |
1644
2097
  | autoContrast | `boolean` | `true` |
2098
+ | wrap | `boolean` | `false` |
1645
2099
 
1646
2100
  `$$restProps` are forwarded to the top-level `pre` element.
1647
2101
 
@@ -1653,12 +2107,13 @@ Arrow keys move between tabs; `Home` and `End` jump to the first and last. The m
1653
2107
  | :------ | :-------- | :------------- |
1654
2108
  | code | `any` | N/A (required) |
1655
2109
  | langtag | `boolean` | `false` |
2110
+ | wrap | `boolean` | `false` |
1656
2111
 
1657
2112
  `$$restProps` are forwarded to the top-level `pre` element.
1658
2113
 
1659
2114
  #### Dispatched Events
1660
2115
 
1661
- - **on:highlight**: fired after `code` is highlighted
2116
+ - **on:highlight**: fired after `code` is highlighted, once per change (not on unrelated re-renders), including when the result is empty (empty `code`)
1662
2117
 
1663
2118
  ```svelte
1664
2119
  <HighlightSvelte
@@ -1680,11 +2135,12 @@ Arrow keys move between tabs; `Home` and `End` jump to the first and last. The m
1680
2135
 
1681
2136
  #### Props
1682
2137
 
1683
- | Name | Type | Default value |
1684
- | :-------- | :--------------- | :------------- |
1685
- | code | `any` | N/A (required) |
1686
- | languages | `LanguageName[]` | `undefined` |
1687
- | langtag | `boolean` | `false` |
2138
+ | Name | Type | Default value |
2139
+ | :------------ | :--------------- | :------------- |
2140
+ | code | `any` | N/A (required) |
2141
+ | languageNames | `LanguageName[]` | `undefined` |
2142
+ | langtag | `boolean` | `false` |
2143
+ | wrap | `boolean` | `false` |
1688
2144
 
1689
2145
  `$$restProps` are forwarded to the top-level `pre` element.
1690
2146
 
@@ -1696,7 +2152,7 @@ import type { LanguageName } from "svelte-highlight";
1696
2152
 
1697
2153
  #### Dispatched Events
1698
2154
 
1699
- - **on:highlight**: fired after `code` is highlighted
2155
+ - **on:highlight**: fired after `code` is highlighted, once per change (not on unrelated re-renders), including when the result is empty (empty `code`, or no candidate language matches)
1700
2156
 
1701
2157
  ```svelte
1702
2158
  <HighlightAuto
@@ -1716,6 +2172,13 @@ import type { LanguageName } from "svelte-highlight";
1716
2172
 
1717
2173
  /** The scope-event stream behind `highlighted`. See "Headless usage" below. */
1718
2174
  console.log(e.detail.events);
2175
+
2176
+ /**
2177
+ * The runner-up candidate and its relevance, for surfacing detection
2178
+ * confidence. `undefined` when no other candidate scored above zero.
2179
+ * @example { language: "typescript", relevance: 6 }
2180
+ */
2181
+ console.log(e.detail.secondBest);
1719
2182
  }}
1720
2183
  />
1721
2184
  ```
@@ -1730,6 +2193,7 @@ import type { LanguageName } from "svelte-highlight";
1730
2193
  | language | { name: `string`; register: `object` } | N/A (required) |
1731
2194
  | tabSize | `number` | `2` |
1732
2195
  | historyLimit | `number` | `200` |
2196
+ | readonly | `boolean` | `false` |
1733
2197
 
1734
2198
  `$$restProps` are forwarded to the top-level `pre` element.
1735
2199
 
@@ -1768,13 +2232,15 @@ Use `bind:this`, then call `undo()`, `redo()`, `focus()`, `selectAll()`, `insert
1768
2232
  | virtualize | `boolean` | `false` |
1769
2233
  | overscan | `number` | `12` |
1770
2234
  | checkpointInterval | `number` | `100` |
2235
+ | doneText | `string` | `"Code finished streaming"` |
1771
2236
 
1772
- `$$restProps` are forwarded to the top-level `pre` element. `overscan` and `checkpointInterval` only apply when `virtualize` is set.
2237
+ `$$restProps` are forwarded to the top-level `pre` element. `overscan` and `checkpointInterval` only apply when `virtualize` is set. `doneText` is announced by a visually-hidden live region once `done` becomes `true`; set it to `""` to disable the announcement.
1773
2238
 
1774
2239
  #### Dispatched Events
1775
2240
 
1776
2241
  - **on:highlight**: fired after each highlight pass, with `{ highlighted }` -- not dispatched when `virtualize` is set
1777
2242
  - **on:done**: fired after the final full highlight once `done` is set
2243
+ - **on:windowchange**: fired with `{ start, end, lineCount }` whenever the rendered window moves -- only dispatched when `virtualize` is set
1778
2244
 
1779
2245
  ```svelte
1780
2246
  <HighlightStream
@@ -1797,7 +2263,15 @@ Use `bind:this`, then call `undo()`, `redo()`, `focus()`, `selectAll()`, `insert
1797
2263
  | overscan | `number` | `12` |
1798
2264
  | checkpointInterval | `number` | `100` |
1799
2265
 
1800
- `$$restProps` are forwarded to the top-level `pre` element (the scroll container -- size it with `style`/`class`).
2266
+ `$$restProps` are forwarded to the top-level `pre` element (the scroll container -- size it with `style`/`class`, but `white-space` is pinned to `pre` and can't be overridden this way).
2267
+
2268
+ #### Methods
2269
+
2270
+ Use `bind:this`, then call `scrollToLine(line)`.
2271
+
2272
+ #### Dispatched Events
2273
+
2274
+ - **on:windowchange**: fired whenever the rendered window changes, with `{ start, end, lineCount }`
1801
2275
 
1802
2276
  ```svelte
1803
2277
  <HighlightVirtual language={json} code={hugeLogDump} style="height: 480px" />
@@ -1814,7 +2288,7 @@ See [Large documents](#large-documents) above.
1814
2288
  | files | `string[]` | N/A (required) |
1815
2289
  | active | `string` | `files[0]` |
1816
2290
 
1817
- `$$restProps` are forwarded to the top-level `div` element. `active` supports `bind:active`.
2291
+ `$$restProps` are forwarded to the top-level `div` element. `active` supports `bind:active` and is reconciled against `files`: an unknown value falls back to `files[0]`, removing the active file selects its former neighbor, and an empty `files` array sets `active` to `undefined`.
1818
2292
 
1819
2293
  #### Dispatched Events
1820
2294
 
@@ -1836,12 +2310,16 @@ See [Large documents](#large-documents) above.
1836
2310
  | speed | `number` | `30` |
1837
2311
  | play | `boolean` | `true` |
1838
2312
  | easing | `(t: number) => number` | `linear` |
2313
+ | granularity | `"char" \| "word"` | `"char"` |
2314
+ | revealed | `number` | `0` |
2315
+ | total | `number` | `0` |
1839
2316
 
1840
- `$$restProps` are forwarded to the top-level `pre` element.
2317
+ `$$restProps` are forwarded to the top-level `pre` element. `revealed`/`total` are read-only in practice (overwritten every frame) but exposed for `bind:revealed`/`bind:total`.
1841
2318
 
1842
2319
  #### Dispatched Events
1843
2320
 
1844
2321
  - **on:done**: fires when typing finishes
2322
+ - **on:progress**: fires whenever `revealed` advances, with `{ revealed, total }`
1845
2323
 
1846
2324
  ```svelte
1847
2325
  <Highlight language={typescript} {code} let:highlighted>
@@ -1855,7 +2333,7 @@ The highlighting engine's output is a flat scope-event stream (`ScopeEvent[]`):
1855
2333
 
1856
2334
  ### Stability tiers
1857
2335
 
1858
- - **Stable, semver-governed:** `ScopeEvent`, `TEXT`/`OPEN`/`CLOSE`, `TokenRange`, `HighlightResult`, `LineToken`, `Renderer`, `renderHtml`, `toRanges`, `extendLines`, `tokenLines`, `escapeHtml`, `createHtmlRenderer`, `createRangeRenderer`, `createLineRenderer`, `Registry` and its methods, `createRegistry`, `registerAll`, `StreamSession`. `Snapshot` is a serializable format that round-trips within one library version, but is **not** guaranteed stable across versions — a snapshot from an older release may be rejected on resume.
2336
+ - **Stable, semver-governed:** `ScopeEvent`, `TEXT`/`OPEN`/`CLOSE`, `TokenRange`, `HighlightResult`, `LineToken`, `Renderer`, `renderHtml`, `toRanges`, `extendLines`, `tokenLines`, `escapeHtml`, `createHtmlRenderer`, `createRangeRenderer`, `createLineRenderer`, `Registry` and its methods, `createRegistry`, `registerAll`, `StreamSession`, `TokenizedDocument`, `createTokenizedDocument`. `Snapshot` is a serializable format that round-trips within one library version, but is **not** guaranteed stable across versions — a snapshot from an older release may be rejected on resume. The same caveat applies to `TokenizedDocument`: its method surface (`setCode`/`append`/`lineCount`/`lineRange`/`tokenizedThrough`/`checkpointCount`) is stable and semver-governed, but internally it resumes from `Snapshot`s the same way `StreamSession` does, so anything that tried to serialize and later resume a `TokenizedDocument`'s internal state directly would hit the same cross-version instability -- the public API doesn't expose that today.
1859
2337
  - **Generated data, versioned with the library:** `GrammarIR`/`GrammarState`. These come from the build pipeline and are consumed by `registerAll`; treat them as opaque payloads whose field-level structure may change in any minor release. Always load grammars from the same package version as the engine.
1860
2338
 
1861
2339
  ### Headless highlighting, isolated registry
@@ -1896,6 +2374,7 @@ import { registry } from "svelte-highlight/registry";
1896
2374
 
1897
2375
  const session = registry.createSession("typescript");
1898
2376
  session.append(chunk); // repeat as chunks arrive
2377
+ session.replace(from, to, text); // patch an earlier range without restarting
1899
2378
  const snapshot = session.snapshot(); // JSON-serializable checkpoint
1900
2379
  const { value } = session.finish();
1901
2380
  ```