Wrap source code in code tags
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
Research direction
Start by reading HtmlClassFormatter and the existing WriteHeader and WriteFooter flow. Compare its generated HTML with the referenced CommonMark fenced-code behavior, then verify that code content is wrapped in a code element and that a language receives the specified class attribute. The issue does not name a test file, so check the repository's existing formatter tests or output examples before changing behavior.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C#
- Stars
- 267
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CommunityToolkit/ColorCode-Universal
-
Json.cs: Catastrophic regex backtracking in Regex_String causes extreme slowdown with JSON arrays Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
CommunityToolkit/ColorCode-Universal#45 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
All issues in CommunityToolkit/ColorCode-Universal
Similar issues
-
Status: Waiting triage Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
nanoframework/Home#1857 ·
-
kind/bug kind/regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno.toolkit.ui#1646 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nightscout/nocturne#1379 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
elastic/esql-dotnet#47 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100