@treelight/python
v0.6.0
Published
Treelight language module for python.
Maintainers
Readme
@treelight/python
Python language definition for Treelight.
Install
npm install @treelight/comment @treelight/core @treelight/python @treelight/regex @treelight/theme-github-darkUsage
import comment from '@treelight/comment';
import { Highlighter } from '@treelight/core';
import python from '@treelight/python';
import regex from '@treelight/regex';
import githubDark from '@treelight/theme-github-dark';
const highlighter = await Highlighter.create({
languages: [python, comment, regex],
themes: [githubDark],
theme: 'github-dark',
});
const html = highlighter.highlight('print("Hello World!")', 'python');This package includes the Tree-sitter grammar WASM and highlight and injection queries for Python. Register @treelight/comment and @treelight/regex to highlight annotations in comments and patterns passed to standard-library re functions.
See the Treelight README for full usage.
