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

feat(build): add support for custom languages #1837

Merged
merged 6 commits into from
Feb 26, 2023

Conversation

JuanM04
Copy link
Contributor

@JuanM04 JuanM04 commented Jan 23, 2023

Fixes #1533

@helloanoop
Copy link

Just when I was looking for this feature, I see this PR. Would be great to have this functionality merged.
@JuanM04 I have a question, How will we pass the textmate grammar in the config. Can you share a code example ?

@JuanM04
Copy link
Contributor Author

JuanM04 commented Jan 24, 2023

@helloanoop Following the example in the shiki documentation, it would end up like this:

// .vitepress/config.js

import {readFileSync} from "fs"

// You don't have to have another file with your grammar, but it's convenient
const myLanguageGrammar = JSON.parse(readFileSync("./path/to/lang.tmLanguage.json"))

const myLanguage = {
  id: "mylanguage",
  scopeName: 'source.mylanguage',
  grammar: myLanguageGrammar,
  aliases: ['my', 'mylang'],
}

export default {
  markdown: {
    languages: [myLanguage]
  }
}

@brc-dd brc-dd self-assigned this Feb 11, 2023
@brc-dd brc-dd merged commit 5a6d384 into vuejs:main Feb 26, 2023
@helloanoop
Copy link

Awesome. Thanks @brc-dd for merging this! Been waiting to use custom textmate grammar based styling for the Bru Lang that I am working on.
https://docs.usebruno.com/bru-language-design.html

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to pass additional languages to shiki
3 participants