Skip to content

text: decode the first chunk in MultiLineValue.Value - #607

Open
chiliec wants to merge 1 commit into
yuin:v2from
chiliec:fix-multiline-value-first-chunk
Open

chiliec wants to merge 1 commit into
yuin:v2from
chiliec:fix-multiline-value-first-chunk

Conversation

@chiliec

@chiliec chiliec commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #603

When a MultiLineValue is backed by non-contiguous source ranges, Value() cloned the first chunk raw and only ran the decoder on the remaining chunks, so entities/backslash escapes on the first line came back undecoded (x & y\nz & w). WriteTo already decodes every chunk; this makes Value() consistent with it.

Change

  • text/value.go: decode the first chunk before appending the rest.
  • text/value_test.go: new test with two non-contiguous indices holding an entity and a backslash escape, asserting Value() and WriteTo() agree.

Verification (go1.25.1, linux/amd64)

  • New test fails on master (Value() = "x & y\nz * w", want "x & y\nz * w") and passes with the change.
  • go test -count=1 ./... — all packages ok; cd parser && go test -tags=goldmark_v1_attribute . — ok.
  • go vet ./text/, gofmt -l text/ — clean.
  • Issue repro (> [a](/u "x & y\n> z & w"), reading Link.Title.Value(src)): before "x & y\nz & w", after "x & y\nz & w".

This branch has not been deployed

No deployments
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.

MultiLineValue.Value() does not decode the first chunk

1 participant