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

Wrap source code in code tags #35

Open
johnW-ret opened this issue Jul 19, 2023 · 0 comments
Open

Wrap source code in code tags #35

johnW-ret opened this issue Jul 19, 2023 · 0 comments

Comments

@johnW-ret
Copy link

Referencing this issue on markdown-colorcode, this package overwrites some of the behavior used in Markdig that appears to be in line with the CommonMark spec, that is, this package does not wrap code using a code element. Additionally, if a language is present, the spec specifies a class="language-[lang]" attribute as well.

I have not started a fork because I am not sure whether this would be a breaking change or not, however, the general change seems rather simple, adding the following methods to HtmlClassFormatter and then wrapping the inner text in WriteHeader and WriteFooter.

private void WriteHeaderCodeStart(ILanguage language)
{
    WriteElementStart("code", language.CssClassName);
}

private void WriteHeaderCodeEnd()
{
    WriteElementEnd("code");
}

In my case, this would make it easier to enforce consistent styling across my app.

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