Detection rules landing page ignores frontmatter in index.md
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- csharp
调研方向
从 src/Elastic.Markdown/Extensions/DetectionRules/DetectionRuleFile.cs 中的 DetectionRuleOverviewFile.GetMarkdown() 开始,检查如何在生成的 Markdown 前包含来自 SourceFile 的 frontmatter。阅读 MarkdownFile.ProcessYamlFrontMatter,了解这些元数据的解析方式。使用 docs/index.md 中的 frontmatter 构建 docset,并确认 mapped_pages 和其他键已应用于生成的着陆页。
由索引模型根据 Issue 内容生成。
描述
What happened?
The detection rules extension builds the landing page of a detection rules docset, its index.md, from generated Markdown. It never reads the file's own contents. Because frontmatter is only read from the parsed document, any frontmatter in index.md is silently dropped, including mapped_pages.
DetectionRuleOverviewFileoverridesGetMinimalParseDocumentAsyncandGetParseDocumentAsyncto parse the string returned byGetMarkdown(). That string starts with# Prebuilt detection rules referenceand has no frontmatter.MarkdownFile.ProcessYamlFrontMatteronly reads frontmatter when the parsed document's first block is aYamlFrontMatterBlock. For this page it never is, somapped_pages,description, and the other keys have no effect.
Impact: the Prebuilt detection rules reference can't list its 8.x equivalents (/guide/en/security/<version>/prebuilt-rules.html) in the version menu. That was requested in elastic/docs-content-internal#750.
How can we reproduce it?
- Add frontmatter to
docs/index.mdin elastic/detection-rules:--- mapped_pages: - https://www.elastic.co/guide/en/security/current/prebuilt-rules.html --- - Build the docset.
- The generated
reference/security/prebuilt-rulespage has no legacy versions, and none of the frontmatter is applied.
Possible fix: in DetectionRuleOverviewFile.GetMarkdown(), put the frontmatter block from SourceFile, if there is one, in front of the generated Markdown. Both parser pipelines already call UseYamlFrontMatter(), so ProcessYamlFrontMatter would then pick it up.
Version or commit
main at e7b055b1c7426661455963a8aa007b5ef50f3da8
Related
elastic/detection-rules#7138 adds the mapped_pages frontmatter above. It takes effect once this is fixed.
- 主要语言
- C#
- 星标
- 25
- 派生
- 44
- 平均合并
- 17 小时 21 分钟
- 30 天内合并 PR
- 343
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
elastic/docs-builder 的其他 Issue
-
enhancement needs triage
难度 2/5 1-3 小时 新手友好度 70/100
elastic/docs-builder#4495 ·
维护者通常 1 天内回复
-
needs triage
难度 2/5 1-3 小时 新手友好度 72/100
elastic/docs-builder#4232 ·
维护者通常 1 天内回复
-
chore needs triage tech-debt
难度 2/5 1-3 小时 新手友好度 68/100
elastic/docs-builder#3567 · 1 条评论 ·
维护者通常 1 天内回复
-
chore needs triage tech-debt
难度 2/5 1-3 小时 新手友好度 78/100
elastic/docs-builder#3566 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement needs triage tech-debt
难度 5/5 一周以上 新手友好度 35/100
elastic/docs-builder#4721 ·
维护者通常 1 天内回复
查看 elastic/docs-builder 的全部 Issue
相似的 Issue
-
Docs typo未关闭
难度 1/5 1 小时以内 新手友好度 78/100
MonoGame/docs.monogame.github.io#328 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
space-wizards/RobustToolbox#7197 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
RicoSuter/Namotion.Interceptor#918 ·
维护者通常 1 天内回复