@scalar/code-highlight 0.3.5 → 0.4.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.
package/dist/css/code.css CHANGED
@@ -188,7 +188,3 @@
188
188
  .hljs.language-objectivec .hljs-built_in {
189
189
  color: var(--scalar-color-orange);
190
190
  }
191
-
192
- .hljs-built_in {
193
- color: var(--scalar-color-orange);
194
- }
@@ -1 +1 @@
1
- {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/languages/basic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAe9C,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAe9C,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/languages/basic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAgB9C,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAe9C,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { LanguageFn } from 'highlight.js';
2
+ /**
3
+ * Mojo grammar.
4
+ *
5
+ * highlight.js does not ship a Mojo grammar and there is no community package
6
+ * for it (the only upstream "mojo" grammar is the unrelated Perl Mojolicious
7
+ * framework). We build one here. Mojo is a superset of Python, so we start from
8
+ * the bundled Python grammar and layer on the extra keywords, argument-convention
9
+ * modifiers, and standard-library types that Mojo adds. The keyword and type
10
+ * lists mirror Modular's official TextMate grammar (github.com/modular/mojo-syntax).
11
+ *
12
+ * As with our custom Python grammar, we also colour call sites as function
13
+ * titles so that API snippets, which are mostly method calls, do not render as a
14
+ * wall of unstyled grey text.
15
+ */
16
+ declare const mojo: LanguageFn;
17
+ export default mojo;
18
+ //# sourceMappingURL=mojo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mojo.d.ts","sourceRoot":"","sources":["../../src/languages/mojo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAG9C;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,IAAI,EAAE,UAgHX,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { LanguageFn } from 'highlight.js';
2
+ /**
3
+ * Python grammar that extends highlight.js' bundled grammar with call-site
4
+ * highlighting.
5
+ *
6
+ * The grammar shipped with highlight.js only scopes function and class
7
+ * *definitions* (`def name`, `class Name`) plus a fixed list of built-ins. It
8
+ * never scopes *call sites*, unlike the JavaScript, Go, and Ruby grammars which
9
+ * colour every `.method()` as a function title. Because real-world API snippets
10
+ * are almost entirely method calls (for example `conn.request(...)` or
11
+ * `response.json()`), Python code rendered as a wall of unstyled grey text and
12
+ * looked far less highlighted than other languages (DOC-5618).
13
+ *
14
+ * We add a single rule that colours any identifier immediately followed by `(`
15
+ * as a function title, mirroring how highlight.js' own JavaScript grammar
16
+ * handles this. Reserved words and the grammar's known built-ins, literals, and
17
+ * types are excluded so they keep their existing scopes, and the leading word
18
+ * boundary prevents the rule from matching the tail end of an excluded word.
19
+ */
20
+ declare const python: LanguageFn;
21
+ export default python;
22
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/languages/python.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAG9C;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,MAAM,EAAE,UAyCb,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -46,6 +46,7 @@ export declare const standardLanguages: {
46
46
  readonly makefile: LanguageFn;
47
47
  readonly markdown: LanguageFn;
48
48
  readonly matlab: LanguageFn;
49
+ readonly mojo: LanguageFn;
49
50
  readonly nginx: LanguageFn;
50
51
  readonly objectivec: LanguageFn;
51
52
  readonly ocaml: LanguageFn;
@@ -1 +1 @@
1
- {"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../src/languages/standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAgD9C;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDiB,CAAA"}
1
+ {"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../src/languages/standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAkD9C;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDiB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/markdown/markdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsD,IAAI,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAuB/G,YAAY,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,OAE9C,CAAA;AAiGD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,UAyDF;A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type HighlightOptions = {
16
16
  subset?: ReadonlyArray<string> | null | undefined;
17
17
  /** Option to autodetect languages */
18
18
  detect?: boolean;
19
+ /** Extra class name(s) to add to highlighted `<code>` elements (optional) */
20
+ className?: ReadonlyArray<string> | string | null | undefined;
19
21
  };
20
22
  /**
21
23
  * Lowlight syntax highlighting plugin for rehype pipelines
@@ -1 +1 @@
1
- {"version":3,"file":"rehype-highlight.d.ts","sourceRoot":"","sources":["../../src/rehype-highlight/rehype-highlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,IAAI,EAAE,MAAM,MAAM,CAAA;AAEzD,OAAO,EAAE,KAAK,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAIlC,KAAK,gBAAgB,GAAG;IACtB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,GAAG,SAAS,CAAA;IACxD,2EAA2E;IAC3E,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;IACrF,2EAA2E;IAC3E,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;IACnE,yGAAyG;IACzG,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;IACpD,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAClC,qFAAqF;IACrF,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;IACjD,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAID;;;;GAIG;AACH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A;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,SAAS,IAwB7E,MAAM,IAAI,EAAE,MAAM,KAAK,UA6DhC"}
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "lowlight",
17
17
  "highlightjs"
18
18
  ],
19
- "version": "0.3.5",
19
+ "version": "0.4.0",
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
@@ -92,7 +92,7 @@
92
92
  "@types/mdast": "^4.0.4",
93
93
  "vfile": "^6.0.3",
94
94
  "vite": "8.0.0",
95
- "@scalar/themes": "0.16.0"
95
+ "@scalar/themes": "0.16.2"
96
96
  },
97
97
  "scripts": {
98
98
  "build": "vite build && tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json && shx cp -r src/css dist/css",