Skip to content

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Mar 5, 2025

Changes

Only allow explicit code callouts after a comment # or //.

This way we avoid cases where there are valid angle brackets in the code.

Related Issues

@reakaleek reakaleek requested a review from a team March 6, 2025 00:04
@reakaleek reakaleek changed the title Allow explicit code callout only after a comment BREAKING CHANGE: Allow explicit code callout only after a comment Mar 6, 2025
@reakaleek reakaleek marked this pull request as ready for review March 6, 2025 11:05
Copilot AI review requested due to automatic review settings March 6, 2025 11:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR implements a breaking change that restricts explicit code callouts so that they are only recognized when preceded by a comment (either "#" or "//"). The changes update documentation, adjust parser logic in the Markdown parser, revise corresponding tests, and update the docs navigation to include the new code callouts page.

Reviewed Changes

File Description
docs/testing/code-callouts.md Added examples illustrating code callouts with preceding comments
src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs Modified parsing logic to only consider callouts after a comment marker
docs/syntax/code.md Updated instructions and examples to reflect the new requirement for explicit callouts
docs/_docset.yml Added the code-callouts documentation page to the docset
tests/Elastic.Markdown.Tests/CodeBlocks/CallOutTests.cs Updated test cases to include the required comment prefix for callouts

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

tests/Elastic.Markdown.Tests/CodeBlocks/CallOutTests.cs:154

  • [nitpick] The class name 'ClassicCallOutsFollowedByListWithWrongCoung' contains a typo; consider renaming it to 'ClassicCallOutsFollowedByListWithWrongCount'.
public class ClassicCallOutsFollowedByListWithWrongCoung(ITestOutputHelper output) : CodeBlockCallOutTests(output, "csharp", 
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best if we inverse the logic here, instead of breaking all the existing code blocks, require those that want to keep the <\d+> at the end of a string to prefix it with \ e.g \<1>.

That way it still works as its always done for the vast majority of cases.

@reakaleek reakaleek closed this Mar 7, 2025
@Mpdreamz Mpdreamz deleted the feature/restricted-code-callouts branch June 12, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants