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

Razor code snippets break doc builds #21

Open
guardrex opened this issue Dec 7, 2019 · 1 comment
Open

Razor code snippets break doc builds #21

guardrex opened this issue Dec 7, 2019 · 1 comment

Comments

@guardrex
Copy link

guardrex commented Dec 7, 2019

Moved from #17 ...

Comment by @guardrex ...

@rloutlaw @DuncanmaMSFT I'm working a conversion PR to get our cshtml code languages for Razor components converted over to razor, but the build resulted in 💥 ...

dotnet/AspNetCore.Docs#16035

Failing with the following error ...

Line : [Error] razor is not supported languaging name, alias or extension for parsing code snippet with tag name, you can use line numbers instead

Comment by @DuncanmaMSFT ...

Ah, we could enable issues, as a fork it didn't seem necessary. So the issue here is not with the syntax highlighting itself, but the way we parse snippets out of code includes. I believe @dend has more awareness of how that works and additional work around snippets.

Comment by @guardrex ...

When you get a chance to look at this @dend, could u let me know about when it might be addressed? The work that I need to do touches many of our topics, so I either need to wait a short time to merge the existing PR if it can be resolved soon or close the existing PR and recreate it later if this can't be resolved for some longer period of time.

@guardrex
Copy link
Author

guardrex commented Dec 7, 2019

I think I've narrowed this down to snippets.

Cross-links without a snippet work 👍 ...

[!code-razor[](samples/SampleApp/Pages/RouteParameter.razor?highlight=1)]

In-text code is fine 👍 ...

```razor
@page "/my-cool-page"

<h1>Cool Blazor Page</h1>
`​`​`

The problem seems to be when using a snippet 💥😢 ...

[!code-razor[](samples/SampleApp/Pages/RouteParameter.razor?name=snippet1&highlight=1)]

... where snippet1 is composed in the file as ...

<!-- <snippet1> -->
@page "/my-cool-page"

<h1>Cool Blazor Page</h1>
<!-- </snippet1> -->

@code {
    ...
}

That approach works if the code language is cshtml (code-cshtml), but switching to razor (code-razor) yields the error ...

razor is not supported languaging name, alias or extension for parsing code snippet with tag name, you can use line numbers instead

My workaround will be to place snippets into the doc markdown files until this is resolved. Having chstml appear on our examples in the Blazor docs is confusing our readers, so I feel that it's important to workaround the issue for now.

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

1 participant