This guide talks about how to use vscat as the NPM package (Javascript/Typescript). To learn about using vscat as a command line utility (npm package), please check the CLI Guide.
# Using Yarn
yarn add vscat
# Using NPM
npm install vscat
import vscat from "vscat";
const highlightedLines = await vscat.highlightSource({
source,
// ...common options
});
width
: line width, where excess characters are trimmed (required).themeIdOrPath
: the ID of a supported theme, or path to a VS Code theme definition (default:default-high-contrast
).languageIdOrPath
: the ID of a supported language, or path to a TextMate grammar file (default: will try to automatically detect based on VS Code language associations).
source
: source code to be highlighted.
beforeSource
: version A of the source file to be diffed.afterSource
: version B of the source file to be diffed.
source
: source code to be highlighted.severity
: One of [error
,warning
,info
,hint
]range
: source range of the diagnostic to be underlined.
Returns a list of the supported languages by this version.
Returns a list of the supported themes by this version.