Repository navigation
コードフェンスのファイル名を表示する (#473) - #484
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
# Conflicts: # .vitepress/theme/style.css
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts: # .vitepress/config.mjs
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
ファイル名と中身が近すぎたので直した(追加コミット)。 原因: 言語ラベル( 直し: 流し込みに戻した(
上端(2px)と右の余白は言語ラベルに合わせたままなので、名前と言語ラベルは同じ行に並ぶ。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #473
VitePress は情報行の
[title]を::: code-groupの中でしか使わない(extractTitleを呼ぶのはcreateCodeGroupだけ)。単独のフェンスではextractLangが空白以降を捨てるので、ファイル名はどこにも出ないまま落ちる。起票時の数え方を訂正
issue には「16 本ともファイル名が表示されていない」と書いたが、実際に数え直すと
[title]の 11 本はすべて::: code-groupの中で、既にタブとして出ていた。落ちていたのは以下。forGitBranch×4(sh .gitattributes)、forIF(csv 注文)、forTerraform(sh リモートステートのpull、編集、push、削除)[title]、code-group の外forMarkdown/sampleの取り込みスニペット(<<< @/…/openapi.yaml{yaml})。VitePress が付ける取り込み元のファイル名が消えていたこの PR で 8 本にファイル名が出る。
作り
lib/markdown-it-plugin-fence-title.mjsがfenceレンダラを包み、空白区切りと[title]の両方を読む。::: code-groupの中は触らない。タブが既に名乗っているので二重になる(トークンを遡ってcontainer_code-group_openを探す){1,3}/:line-numbers/=5/twoslash/vueは VitePress の指定なのでファイル名として扱わない(原稿には 1 件も無いが、書かれたときに壊れないように)mermaidより前に包んで、mermaid のプラグインが外側に残るようにしている見た目は右上の言語ラベル(
span.lang)を左右で鏡にした形。位置はpreの上の余白(20px)の中で、左端はコードの文字(codeのpadding: 24px)にそろえる。言語ラベルはカーソルを乗せるとコピーボタンに譲って消えるが、ファイル名はブロックの名前なので消さない。 色は言語ラベルより一段強い段(--vp-c-text-2。コードの地で 5.62 / 暗い側 6.31)。::: code-groupのタブが壊れていないことは確認済み(data-title8 件が before と同じ)。確認
documents/forGitBranch/git_setup_guidelines.html….gitattributesが 4 か所documents/forIF/if_guidelines.html…注文documents/forMarkdown/sample/api_reference.html…openapi.yaml(取り込みスニペット)documents/forTerraform/terraform_guidelines.htmlの code-group のタブforTerraformのリモートステートのpull、編集、push、削除はファイル名ではなく説明文で、タブに出ると長い。原稿を直すかは別(この PR では出したまま)。🤖 Generated with Claude Code