Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] import syntaxes and themes from dependency #9

Closed
shigma opened this issue Feb 28, 2019 · 1 comment
Closed

[feature request] import syntaxes and themes from dependency #9

shigma opened this issue Feb 28, 2019 · 1 comment

Comments

@shigma
Copy link

shigma commented Feb 28, 2019

Hi there! shiki is really awesome and thanks for your effort.

I hope syntaxes and themes will be available from dependency so we can make the most of the vast ecosystem of vscode.

Example:

// package.json
{
  "dependencies": {
    "vscode-night-owl": "https://github.com/sdras/night-owl-vscode-theme",
    "vscode-rainbow-csv": "https://github.com/mechatroner/vscode_rainbow_csv"
  }
}
shiki.use('vscode-night-owl')
shiki.use('vscode-rainbow-csv')

shiki.getHighlighter({
  theme: 'night-owl'
}).then(highlighter => {
  return highlighter.codeToHtml('foo,bar,baz', 'csv')
})
@octref
Copy link
Collaborator

octref commented Aug 19, 2020

I added guide for adding a new theme. I don't think we are bundling night-owl, but you can easily add it locally by downloading https://github.com/sdras/night-owl-vscode-theme/blob/master/themes/Night%20Owl-color-theme.json, and then load it with:

const shiki = require('shiki')

const t = shiki.loadTheme(<PATH-TO-JSON>)

shiki.getHighlighter({
  theme: t
})

There's no easy way to access VS Code extension programmatically, so I can't look it up by publisher/id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants