Skip to content

Ignore literal <embed-code> examples inside Markdown fenced blocks#35

Merged
alexander-yevsyukov merged 4 commits into
masterfrom
copilot/fix-embed-code-documentation
May 20, 2026
Merged

Ignore literal <embed-code> examples inside Markdown fenced blocks#35
alexander-yevsyukov merged 4 commits into
masterfrom
copilot/fix-embed-code-documentation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

The parser treated literal <embed-code> snippets in documentation examples as real embedding instructions, which caused check-mode failures and panics in docs that demonstrate usage. This change makes fenced Markdown examples non-actionable while keeping real embedding behavior unchanged.

  • Parser behavior: distinguish docs examples from real embed instructions

    • Track normal Markdown fence state (marker + indentation) while scanning regular lines.
    • Skip <embed-code...> recognition when currently inside a non-embedding Markdown fenced block.
  • Fence handling: make closing detection marker-aware

    • Store the opening fence marker for active embedding code blocks.
    • Close only on a valid matching fence (same marker kind, sufficient marker length, no trailing content), preventing premature closure on lines like ```kotlin.
  • Regression coverage

    • Added a fixture with a fenced Markdown sample that contains a literal <embed-code> block and inner code fences.
    • Added an embedding test asserting this doc is processed without embedding parse errors and remains up-to-date.
````markdown
<embed-code
  file="$root/version.gradle.kts"
  start="val validationVersion"
  end="val validationVersion">
</embed-code>
```kotlin
val validationVersion by extra("2.0.0-SNAPSHOT.419")
```

Agent-Logs-Url: https://github.com/SpineEventEngine/embed-code-go/sessions/256ee357-1fd4-4be8-b34c-a4f45005ced8

Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix samples for embed-code in documentation Ignore literal <embed-code> examples inside Markdown fenced blocks May 19, 2026
Copilot AI requested a review from alexander-yevsyukov May 19, 2026 00:39
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review May 19, 2026 00:40
@alexander-yevsyukov
Copy link
Copy Markdown
Contributor

@armiol, @Oleg-Melnik, FYI.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0de161d45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread embedding/parsing/regular_line.go
Copy link
Copy Markdown
Collaborator

@dmytro-kashcheiev dmytro-kashcheiev left a comment

Choose a reason for hiding this comment

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

@alexander-yevsyukov LGTM from my side.

Comment thread embedding/parsing/regular_line.go
Copy link
Copy Markdown
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

@copilot please act on the comments.

Comment thread embedding/parsing/regular_line.go
Copilot AI and others added 2 commits May 20, 2026 14:41
Agent-Logs-Url: https://github.com/SpineEventEngine/embed-code-go/sessions/b83b1b2b-e78b-4cd6-b3bc-f295e9c4b0b9

Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpineEventEngine/embed-code-go/sessions/b83b1b2b-e78b-4cd6-b3bc-f295e9c4b0b9

Co-authored-by: alexander-yevsyukov <3116444+alexander-yevsyukov@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 20, 2026

@copilot please act on the comments.

Addressed in 40ac5f8 (plus cleanup in b479d80). I applied the requested backticks-only fence parsing fix and added regression coverage.

Copy link
Copy Markdown
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Collaborator

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk left a comment

Choose a reason for hiding this comment

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

LGTM

@alexander-yevsyukov alexander-yevsyukov merged commit 2cef9ff into master May 20, 2026
3 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the copilot/fix-embed-code-documentation branch May 20, 2026 15:06
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.

It is not possible to to use samples of <embed-code> in the documentation

4 participants