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] Add plain text support. #534

Closed
zhuozhiyongde opened this issue Nov 4, 2023 · 2 comments
Closed

[Feature Request] Add plain text support. #534

zhuozhiyongde opened this issue Nov 4, 2023 · 2 comments

Comments

@zhuozhiyongde
Copy link

As the title suggests, shiki is being used as the code rendering module for my blog, but when I specify text language, it will not render because it cannot recognize this language. I hope to add support for plain text and further, perhaps render all unknown language formats in a form that can be displayed as plain text.

@nova1751
Copy link

Actually, if you don't specify the code block lang option,the shiki will return the original code block format.Hope this can help you.

@antfu
Copy link
Member

antfu commented Jan 26, 2024

We treat these languages are plain text:

/**
* Check if the language is plaintext that is ignored by Shiki.
*
* Hard-coded plain text languages: `plaintext`, `txt`, `text`, `plain`.
*/
export function isPlainLang(lang: string | null | undefined) {
return !lang || ['plaintext', 'txt', 'text', 'plain'].includes(lang)
}

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

No branches or pull requests

3 participants