How to use the lowlight.highlightAuto function in lowlight

To help you get started, we’ve selected a few lowlight examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / lowlight / lowlight-tests.ts View on Github external
console.log(highlight('typescript',
`class CPP {
    private year: number;
    public constructor(private version: string) {
        this.year = Number(version.match(/.+\d+$/));
    }

    public version(): string {
        return this.version;
    }
}
`
));

console.info(highlightAuto(
`class CPP {
    private year: number;
    public constructor(private version: string) {
        this.year = Number(version.match(/.+\d+$/));
    }

    public version(): string {
        return this.version;
    }
}
`
));

core.registerLanguage('math', highlighter);

console.log(core.highlight('javascript',
github sapegin / fledermaus / src / renderers / markdown.js View on Github external
visit(ast, 'code', node => {
			if (!node.data) {
				node.data = {};
			}

			const lang = node.lang;
			const highlighted = lang
				? low.highlight(aliases[lang] || lang, node.value).value
				: low.highlightAuto(node.value).value;
			node.data.hChildren = highlighted;
			node.data.hProperties = {
				className: ['hljs', lang && `language-${lang}`],
			};
		});
}