bug(pipelines): shortcode stripping deletes text between a {{< >}} shortcode and the next {{% %}}

オープン 初心者向け
#293 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@Ashborne-lab がすでに取り組んでいます。

2026年11月14日 から。

  • #294 @Ashborne-lab による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
data

調査の方向性

バグは docs-agent-mcp/pipelines/utils/canonical_rag_ingest.py の HUGO_SHORTCODE_RE にあり、_strip_hugo_artifacts() から使われています。issue の再現スニペットを実行してください。'A B' ではなく 'A keep this B' と出力されるはずです。{{< のショートコード分岐が、後に出現する %}} までのテキストにマッチしなくなり、山括弧のショートコードとパーセントのショートコードの間のテキストをテストがカバーすれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Area

pipelines

What happened

HUGO_SHORTCODE_RE in docs-agent-mcp/pipelines/utils/canonical_rag_ingest.py is

re.compile(r"\{\{.*?%\}\}|\{\{.*?\}\}", re.DOTALL)

The first alternative can start at any {{, not only at {{%. When the parser reaches an angle-bracket shortcode such as {{< figure ... >}}, that alternative matches lazily forward to the next %}} anywhere later in the page, and _strip_hugo_artifacts() deletes everything in between, before the document is split into sections and chunks.

On the current kubeflow/website content (commit a7b22c9), running every page through parse_canonical_document() with the current regex and with a fixed one shows text lost on 5 pages (970 characters in total). The largest case is content/en/docs/started/installing-kubeflow/index.md, which loses the rows for five packaged distributions (prokube.ai, Microsoft Azure, Nutanix, QBO and Red Hat). Those vendors never reach the index, so the assistant cannot answer "is there a Kubeflow distribution for Azure / Red Hat / Nutanix?" from the docs. The other four pages are API reference pages that lose their spec link text.

Expected behavior

Only the shortcodes themselves are removed. Text between two shortcodes is kept.

Reproduction

From the repo root:

import sys
sys.path.insert(0, "docs-agent-mcp/pipelines/utils")
from canonical_rag_ingest import _strip_hugo_artifacts

print(repr(_strip_hugo_artifacts(
    'A {{< figure src="/a.png" >}} keep this {{% kf-latest-version %}} B'
)))

Output on main (145409a): 'A B'
Expected: 'A keep this B'

Environment: local, Python 3.12, no cluster needed.

Suspected files

docs-agent-mcp/pipelines/utils/canonical_rag_ingest.py (HUGO_SHORTCODE_RE, _strip_hugo_artifacts)

I have a fix with tests ready and will open a PR.

主要言語
Python
スター
49
フォーク
122
平均マージ
10時間 54分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

kubeflow/docs-agent のほかの issue

kubeflow/docs-agent の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。