@scalar/code-highlight
Advanced tools
| import type { LanguageFn } from 'highlight.js'; | ||
| /** | ||
| * Python grammar that extends highlight.js' bundled grammar with call-site | ||
| * highlighting. | ||
| * | ||
| * The grammar shipped with highlight.js only scopes function and class | ||
| * *definitions* (`def name`, `class Name`) plus a fixed list of built-ins. It | ||
| * never scopes *call sites*, unlike the JavaScript, Go, and Ruby grammars which | ||
| * colour every `.method()` as a function title. Because real-world API snippets | ||
| * are almost entirely method calls (for example `conn.request(...)` or | ||
| * `response.json()`), Python code rendered as a wall of unstyled grey text and | ||
| * looked far less highlighted than other languages (DOC-5618). | ||
| * | ||
| * We add a single rule that colours any identifier immediately followed by `(` | ||
| * as a function title, mirroring how highlight.js' own JavaScript grammar | ||
| * handles this. Reserved words and the grammar's known built-ins, literals, and | ||
| * types are excluded so they keep their existing scopes, and the leading word | ||
| * boundary prevents the rule from matching the tail end of an excluded word. | ||
| */ | ||
| declare const python: LanguageFn; | ||
| export default python; | ||
| //# sourceMappingURL=python.d.ts.map |
| {"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"} |
+7
-0
| # @scalar/code-highlight | ||
| ## 0.3.6 | ||
| ### Patch Changes | ||
| - [#9508](https://github.com/scalar/scalar/pull/9508): Fix Python code samples appearing mostly unstyled by highlighting function and method call sites | ||
| - [#9506](https://github.com/scalar/scalar/pull/9506): Add Scalar scrollbar styling to highlighted Markdown code blocks. | ||
| ## 0.3.5 | ||
@@ -4,0 +11,0 @@ |
@@ -191,5 +191,1 @@ .scalar-app { | ||
| } | ||
| .hljs-built_in { | ||
| color: var(--scalar-color-orange); | ||
| } |
@@ -1,1 +0,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"} | ||
| {"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"} |
@@ -1,1 +0,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"} | ||
| {"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../src/languages/standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAiD9C;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDiB,CAAA"} |
@@ -1,1 +0,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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AE,MAAM,CAAA;CACvB,UA2DF;AASD;;GAEG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAU,GAChB;IACD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,EAAE,CAiBF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,MAAM,CAUpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,YAgC5C"} |
@@ -19,2 +19,4 @@ import type { Root } from 'hast'; | ||
| detect?: boolean; | ||
| /** Extra class name(s) to add to highlighted `<code>` elements (optional) */ | ||
| className?: ReadonlyArray<string> | string | null | undefined; | ||
| }; | ||
@@ -21,0 +23,0 @@ /** |
@@ -1,1 +0,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,EA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AC,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;IAChB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAC9D,CAAA;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,SAAS,IAwB7E,MAAM,IAAI,EAAE,MAAM,KAAK,UA6DhC"} |
+1
-1
@@ -19,3 +19,3 @@ { | ||
| ], | ||
| "version": "0.3.5", | ||
| "version": "0.3.6", | ||
| "engines": { | ||
@@ -22,0 +22,0 @@ "node": ">=22" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
3768952
0.22%58
3.57%51791
0.13%0
-100%