Wrap source code in code tags
还没有人认领这个 Issue。
评估
调研方向
首先阅读 HtmlClassFormatter 以及现有的 WriteHeader 和 WriteFooter 流程。将其生成的 HTML 与所引用的 CommonMark 围栏代码行为进行比较,然后确认代码内容被包裹在 code 元素中,并且某种语言获得指定的 class 属性。该 issue 未指定测试文件,因此在更改行为之前,请检查 repository 中现有的 formatter 测试或输出示例。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 267
- 派生
- 58
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CommunityToolkit/ColorCode-Universal 的其他 Issue
-
Json.cs: Catastrophic regex backtracking in Regex_String causes extreme slowdown with JSON arrays 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
CommunityToolkit/ColorCode-Universal#45 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 20/100
-
难度 3/5 1-2 天 新手友好度 30/100
-
难度 3/5 1-2 天 新手友好度 38/100
-
难度 3/5 1-2 天 新手友好度 38/100
查看 CommunityToolkit/ColorCode-Universal 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
nightscout/nocturne#1425 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
Documentation
难度 2/5 1-3 小时 新手友好度 75/100
cake-build/cake#5024 ·
-
Frontend status/draft TechnicalDebt
难度 2/5 1-2 天 新手友好度 75/100
Altinn/altinn-auth#4143 ·