Repository navigation
Conversation
SafeText paired any run of three backticks or tildes with the next run of either kind, so a longer fence quoting markdown was closed at its first inner run and the rest of the quoted evidence reached the chat provider as prose. Fences now follow the CommonMark rules: a fence line has at most three spaces before its run, and its block ends only on a line holding a run of the same character at least as long and nothing else; an unclosed fence drops to the end. Other runs (after text, inside a blockquote or list item, in text collapsed to one line) are dropped up to the latest end a code span or a container fence could have, and a fence line met first starts its own block. Ambiguous markdown errs toward dropping.
BaaRai
force-pushed
the
fix/safetext-nested-fences
branch
from
December 4, 2026 00:51
d155fc7 to
a70c0d7
Compare
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.
Summary
chatbridge.SafeTextpaired any run of three backticks or tildes with the next one of either kind, so a longer fence quoting markdown was closed at the first inner run: a four-backtick fence around a three-backtickhttpblock, amarkdownfence holding inline triple backticks, or a backtick block inside a tilde fence. The rest of the quoted evidence then went to the chat provider as prose when excerpts or shared text were on.Changes
Tests
chatbridge/outbound_nested_fence_test.go: four- and five-backtick fences, tilde and backtick mixes, blockquotes, unordered list items (2-space continuation), ordered list items (3-space continuation), a longer closing run, unclosed fences, a collapsed one-line case, and inline triple-backtick spans.go test -race ./chatbridgepasses.Behaviour change
Ambiguous markdown errs toward dropping: a fence opened on the same line as a list marker may drop the list items after it.