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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cs files! Yes I do use vitepress to document C# libraries 馃榿 #861

Closed
4 tasks done
emersonbottero opened this issue Jun 26, 2022 · 5 comments
Closed
4 tasks done
Labels
build Related to the build system enhancement New feature or request

Comments

@emersonbottero
Copy link

Is your feature request related to a problem? Please describe.

Although C# is one of the available languages it does not recognize cs extension while trying to use <<< to import code.

[vite] Internal server error: No language registration for cs

Describe the solution you'd like

I'm not sure how it work internally but it seems in only missing the recognition of cs files as C# language!

Describe alternatives you've considered

If it can be done by default great.
If this needs an configuration maybe updating the docs would suffice.

Additional context

I have support for other languages would improve the usage (and popularity) of vitepress 馃

Validations

@xfq
Copy link
Contributor

xfq commented Jun 26, 2022

Have you tried csharp / c# instead of cs?

The currently supported languages are documented in https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages

@emersonbottero
Copy link
Author

emersonbottero commented Jun 26, 2022

Have you tried csharp / c# instead of cs?

The currently supported languages are documented in https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages

I can't replace the file extensions I'm using in the library.

I guess you misunderstood...
I'm not trying to use ``` sintax, those work

I'm using <<< like in https://vitepress.vuejs.org/guide/markdown.html#import-code-snippets

@xfq
Copy link
Contributor

xfq commented Jun 26, 2022

Sorry, I misunderstood. You're right, VitePress doesn't support the <<< @/test.cs syntax indeed.

@brc-dd brc-dd added enhancement New feature or request build Related to the build system labels Jun 26, 2022
@brc-dd
Copy link
Member

brc-dd commented Jun 26, 2022

Thanks for pointing this out. We are probably just adding the extension as the language in our snippet plugin. We should instead be mapping the extension to language the way linguist does. Alternatively, we can also implement something similar to this: https://github.com/fabioaanthony/markdown-it-vuepress-code-snippet-enhanced

Also, even in fenced code blocks, we don't currently show language on top right for C# I guess. We have a hard coded list in our CSS to do that. But I guess this can be fixed in the code block plugin itself (the way we added copy, we can add another span telling the language and just style it from CSS, it will eliminate the need for hard coding).

@yxw007
Copy link

yxw007 commented Sep 23, 2022

Is your feature request related to a problem? Please describe.

Although C# is one of the available languages it does not recognize cs extension while trying to use <<< to import code.

[vite] Internal server error: No language registration for cs

Describe the solution you'd like

I'm not sure how it work internally but it seems in only missing the recognition of cs files as C# language!

Describe alternatives you've considered

If it can be done by default great. If this needs an configuration maybe updating the docs would suffice.

Additional context

I have support for other languages would improve the usage (and popularity) of vitepress 馃

Validations

<<< @/snippets/csharp-snippets.cs{csharp}

It's work ok

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Related to the build system enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants