Socket
Socket
Sign inDemoInstall

@shikijs/transformers

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shikijs/transformers - npm Package Compare versions

Comparing version 1.16.2 to 1.16.3

132

dist/index.d.ts
import { ShikiTransformer, ShikiTransformerContext } from 'shiki';
import { Element } from 'hast';
interface TransformerRenderWhitespaceOptions {
interface TransformerCompactLineOption {
/**
* Class for tab
*
* @default 'tab'
* 1-based line number.
*/
classTab?: string;
line: number;
classes?: string[];
}
/**
* Transformer for `shiki`'s legacy `lineOptions`
*/
declare function transformerCompactLineOptions(lineOptions?: TransformerCompactLineOption[]): ShikiTransformer;
interface TransformerNotationDiffOptions {
/**
* Class for space
*
* @default 'space'
* Class for added lines
*/
classSpace?: string;
classLineAdd?: string;
/**
* Position of rendered whitespace
* @default all position
* Class for removed lines
*/
position?: 'all' | 'boundary' | 'trailing';
classLineRemove?: string;
/**
* Class added to the <pre> element when the current code has diff
*/
classActivePre?: string;
}
/**
* Render whitespaces as separate tokens.
* Apply with CSS, it can be used to render tabs and spaces visually.
* Use `[!code ++]` and `[!code --]` to mark added and removed lines.
*/
declare function transformerRenderWhitespace(options?: TransformerRenderWhitespaceOptions): ShikiTransformer;
declare function transformerNotationDiff(options?: TransformerNotationDiffOptions): ShikiTransformer;
/**
* Remove line breaks between lines.
* Useful when you override `display: block` to `.line` in CSS.
*/
declare function transformerRemoveLineBreak(): ShikiTransformer;
/**
* Remove notation escapes.
* Useful when you want to write `// [!code` in markdown.
* If you process `// [\!code ...]` expression, you can get `// [!code ...]` in the output.
*/
declare function transformerRemoveNotationEscape(): ShikiTransformer;
interface TransformerCompactLineOption {
interface TransformerNotationErrorLevelOptions {
classMap?: Record<string, string | string[]>;
/**
* 1-based line number.
* Class added to the <pre> element when the current code has diff
*/
line: number;
classes?: string[];
classActivePre?: string;
}
/**
* Transformer for `shiki`'s legacy `lineOptions`
* Allow using `[!code error]` `[!code warning]` notation in code to mark highlighted lines.
*/
declare function transformerCompactLineOptions(lineOptions?: TransformerCompactLineOption[]): ShikiTransformer;
declare function transformerNotationErrorLevel(options?: TransformerNotationErrorLevelOptions): ShikiTransformer;

@@ -96,47 +89,40 @@ interface TransformerNotationFocusOptions {

declare function parseMetaHighlightWords(meta: string): string[];
interface TransformerMetaWordHighlightOptions {
/**
* Class for highlighted words
*
* @default 'highlighted-word'
*/
className?: string;
}
/**
* Allow using `/word/` in the code snippet meta to mark highlighted words.
* Remove line breaks between lines.
* Useful when you override `display: block` to `.line` in CSS.
*/
declare function transformerMetaWordHighlight(options?: TransformerMetaWordHighlightOptions): ShikiTransformer;
declare function transformerRemoveLineBreak(): ShikiTransformer;
interface TransformerNotationDiffOptions {
/**
* Remove notation escapes.
* Useful when you want to write `// [!code` in markdown.
* If you process `// [\!code ...]` expression, you can get `// [!code ...]` in the output.
*/
declare function transformerRemoveNotationEscape(): ShikiTransformer;
interface TransformerRenderWhitespaceOptions {
/**
* Class for added lines
* Class for tab
*
* @default 'tab'
*/
classLineAdd?: string;
classTab?: string;
/**
* Class for removed lines
* Class for space
*
* @default 'space'
*/
classLineRemove?: string;
classSpace?: string;
/**
* Class added to the <pre> element when the current code has diff
* Position of rendered whitespace
* @default all position
*/
classActivePre?: string;
position?: 'all' | 'boundary' | 'trailing';
}
/**
* Use `[!code ++]` and `[!code --]` to mark added and removed lines.
* Render whitespaces as separate tokens.
* Apply with CSS, it can be used to render tabs and spaces visually.
*/
declare function transformerNotationDiff(options?: TransformerNotationDiffOptions): ShikiTransformer;
declare function transformerRenderWhitespace(options?: TransformerRenderWhitespaceOptions): ShikiTransformer;
interface TransformerNotationErrorLevelOptions {
classMap?: Record<string, string | string[]>;
/**
* Class added to the <pre> element when the current code has diff
*/
classActivePre?: string;
}
/**
* Allow using `[!code error]` `[!code warning]` notation in code to mark highlighted lines.
*/
declare function transformerNotationErrorLevel(options?: TransformerNotationErrorLevelOptions): ShikiTransformer;
declare function parseMetaHighlightString(meta: string): number[] | null;

@@ -156,4 +142,18 @@ interface TransformerMetaHighlightOptions {

declare function parseMetaHighlightWords(meta: string): string[];
interface TransformerMetaWordHighlightOptions {
/**
* Class for highlighted words
*
* @default 'highlighted-word'
*/
className?: string;
}
/**
* Allow using `/word/` in the code snippet meta to mark highlighted words.
*/
declare function transformerMetaWordHighlight(options?: TransformerMetaWordHighlightOptions): ShikiTransformer;
declare function createCommentNotationTransformer(name: string, regex: RegExp, onMatch: (this: ShikiTransformerContext, match: string[], line: Element, commentNode: Element, lines: Element[], index: number) => boolean, removeEmptyLines?: boolean): ShikiTransformer;
export { type TransformerCompactLineOption, type TransformerMetaHighlightOptions, type TransformerMetaWordHighlightOptions, type TransformerNotationDiffOptions, type TransformerNotationErrorLevelOptions, type TransformerNotationFocusOptions, type TransformerNotationHighlightOptions, type TransformerNotationWordHighlightOptions, type TransformerRenderWhitespaceOptions, createCommentNotationTransformer, parseMetaHighlightString, parseMetaHighlightWords, transformerCompactLineOptions, transformerMetaHighlight, transformerMetaWordHighlight, transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight, transformerRemoveLineBreak, transformerRemoveNotationEscape, transformerRenderWhitespace };
{
"name": "@shikijs/transformers",
"type": "module",
"version": "1.16.2",
"version": "1.16.3",
"description": "Collective of common transformers transformers for Shiki",

@@ -33,3 +33,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"dependencies": {
"shiki": "1.16.2"
"shiki": "1.16.3"
},

@@ -36,0 +36,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc