feat(markdown): add CommentType.markdown backed by tree-sitter-markdown#95
Draft
HartmannNico wants to merge 2 commits into
useblocks:mainuseblocks/sphinx-codelinks:mainfrom
HartmannNico:feat/markdown-support-prHartmannNico/sphinx-codelinks:feat/markdown-support-prCopy head branch name to clipboard
Draft
feat(markdown): add CommentType.markdown backed by tree-sitter-markdown#95HartmannNico wants to merge 2 commits intouseblocks:mainuseblocks/sphinx-codelinks:mainfrom HartmannNico:feat/markdown-support-prHartmannNico/sphinx-codelinks:feat/markdown-support-prCopy head branch name to clipboard
HartmannNico wants to merge 2 commits into
useblocks:mainuseblocks/sphinx-codelinks:mainfrom
HartmannNico:feat/markdown-support-prHartmannNico/sphinx-codelinks:feat/markdown-support-prCopy head branch name to clipboard
Conversation
Add support for Markdown HTML-comment traceability markers: Changes: - source_discover/config.py: add 'markdown' to COMMENT_FILETYPE (.md/.markdown) and CommentType.markdown enum value - analyse/utils.py: add MARKDOWN_QUERY '(html_block) @comment', wire tree_sitter_markdown in init_tree_sitter(); no SCOPE_NODE_TYPES entry (markdown has no function/class scopes; oneline-only mode) - pyproject.toml: add tree-sitter-markdown>=0.5.1 dependency Note: callers must set end_sequence=' -->' (not the default newline) because the html_block node text includes the full '<!-- ... -->' delimiters. Closes #NNN. Template: PR-82 (TypeScript).
Member
|
Nice, I will check this out. We are building the features in codelinks in sync with ubCode, so bear with me a little while I do that :) |
Member
|
I approved the CI, it fails. |
…attern - Fix test_source_discover + test_src_trace: add 'markdown' to expected comment_type validation error message list - Add FE_MARKDOWN feature need to docs/source/components/features.rst (fixes docs build warnings for IMPL_MD_1/IMPL_MD_3/IMPL_LANG_1) - Add default_oneliner_markdown fixture to tests/data/extraction/oneline.yaml with end_sequence: " -->" config - Generate snapshot for the markdown extraction fixture - Add init_markdown_tree_sitter fixture + test_extract_comments_markdown + test_init_tree_sitter_markdown to tests/test_analyse_utils.py - Add 'markdown' entry to LANG_MAP in tests/test_extraction_fixtures.py - Update docs: configuration.rst (supported values + table row), analyse.rst (language support list), change_log.rst (Unreleased entry)
Author
|
pushed tests and doc as well. used pr #92 bash as template. |
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.
Closes #94
Summary
Adds
comment_type: markdownbacked bytree-sitter-markdown, enabling<!-- @needs … -->HTML-comment markers in Markdown files to be ingested as traceability nodes by sphinx-codelinks.Primary use case: AI agent and skill definition files (
.claude/agents/*.md,.github/prompts/*.md) that are the actual implementation artefacts of agentic systems and need to participate in a requirements → architecture → design → implementation traceability chain.Changes (3 files, ~24 lines)
source_discover/config.py"markdown": ["md", "markdown"]toCOMMENT_FILETYPEmarkdown = "markdown"toCommentTypeenumanalyse/utils.pyMARKDOWN_QUERY = """(html_block) @comment"""— tree-sitter-markdown maps standalone<!-- … -->blocks tohtml_blocknodeselif comment_type == CommentType.markdown:branch ininit_tree_sitter()importingtree_sitter_markdownSCOPE_NODE_TYPESentry: Markdown has no function/class scopes; oneline-only mode never invokes scope associationpyproject.tomltree-sitter-markdown>=0.5.1Caller note
Because
html_blocknode text includes the full<!-- … -->delimiters, callers must configureend_sequence: " -->"(not the default"\n") in theironeline_comment_style. This is the only behavioural difference from all othercomment_typeentries.Example conf:
Relation to other PRs
Analogous to PR #92 (bash). PR #82 (TypeScript) was the structural template.
This PR is independent of PR #92 — it is based directly on
mainand does not require bash support to be merged first.