Skip to content

✨ NEW: Capture comment text as one-line codelink description - #96

Open
floroks wants to merge 1 commit into
useblocks:mainfrom
floroks:feat/use-description-in-codelink
Open

✨ NEW: Capture comment text as one-line codelink description#96
floroks wants to merge 1 commit into
useblocks:mainfrom
floroks:feat/use-description-in-codelink

Conversation

@floroks

@floroks floroks commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Add a description_position option to OneLineCommentStyle that lets the comment lines directly above or below a one-line marker be used as the body/content of the generated need. Defaults to none (disabled) to preserve existing behavior.

Why? When using one-line comments, the description with the links is usually empty, when the rest of the comment (where the one-line comment appears) would have all of the information needed. This can also be used to combine the description for the unit construction (by utilizing the comment), with the actual implementation.

@floroks
floroks force-pushed the feat/use-description-in-codelink branch 2 times, most recently from a71d495 to 658083e Compare July 28, 2026 07:06
@floroks
floroks marked this pull request as ready for review July 28, 2026 07:17
Add a `description_position` option to `OneLineCommentStyle` that lets the
comment lines directly above or below a one-line marker be used as the
body/content of the generated need. Defaults to `none` (disabled) to
preserve existing behavior.

Signed-off-by: Florian Roks <florian.roks@mercedes-benz.com>
@floroks
floroks force-pushed the feat/use-description-in-codelink branch from 658083e to f45289c Compare July 28, 2026 08:20
@ubmarco

ubmarco commented Jul 28, 2026

Copy link
Copy Markdown
Member

Thanks for the PR. Same problem as in
#44
#66

What's the markup of that text? Currently sphinx-codelinks uses src-trace to pull in markers to the docs. The rendering of the content therefore depends on the language the file is written in.
If rst -> must be rst markup, if md, must be md markup.
We need a solution to this first.

@floroks

floroks commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Same problem as in #44 #66

What's the markup of that text? Currently sphinx-codelinks uses src-trace to pull in markers to the docs. The rendering of the content therefore depends on the language the file is written in. If rst -> must be rst markup, if md, must be md markup. We need a solution to this first.

That's a valid concern I didn't think of - I locally added m2r2 and a mapping for each programming comment language language and a generic convert function. I put rust/go in a static map as "markdown", so the convert function then looks that up, and utilizes m2r2 to convert it to rst - this should be sufficient for the item description and title, and be extensible for other conversion types in the future. I still have to validate it locally, but what are your thoughts on that solution?

@ubmarco ubmarco mentioned this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants