When formatting, replace inline ASCII quotes with typographic quotes#701
Merged
michaelficarra merged 4 commits intoJun 25, 2026
Merged
Conversation
Member
|
In editor call today, I asked to confirm that this auto-formatting also would have made all of the changes from tc39/ecma262#3861 for us automatically. |
Member
|
Also, do we have tests for the formatter that we can add to? In particular, I think the negative cases will be valuable. |
Member
|
Yes: https://github.com/tc39/ecmarkup/blob/39c401c8ba885942c142cfff513a9d5476d83640/test/formatter.ts (Including negative tests in the form of |
Member
|
Then let's also add tests for this @gibson042. |
Member
Author
This was a great idea, and did in fact find some bugs (now fixed).
Done. |
ff2dac2 to
2ee368b
Compare
nicolo-ribaudo
approved these changes
Jun 25, 2026
michaelficarra
approved these changes
Jun 25, 2026
2ee368b to
cc083c2
Compare
Ref tc39/ecma262#3861 (review) Ref tc39#173 Ref tc39#317 Note that this processing cannot be scoped to individual text nodes because e.g. `a "<a href="…">binary64</a> value"` should get rewritten into `a “<a href="…">binary64</a> value”` (but the same would not be true if the medial element were block-level rather than inline). ASCII quotes are not replaced inside of HTML comments, `<code>`/`<emu-val>` elements, backtick spans (e.g., ``` `code` ```), asterisk spans (e.g., `*"string"*`), or after equals signs (as in HTML element attributes).
cc083c2 to
6a825ac
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.
Ref tc39/ecma262#3861 (review)
Ref #173
Ref #317
Note that this processing cannot be scoped to individual text nodes because logical quotations can span across those, e.g. a "<a href="…">binary64</a> value" should get rewritten into a “<a href="…">binary64</a> value” (but the same would not be true if the medial element were block-level rather than inline).
ASCII quotes are not replaced inside of HTML comments,
<code>/<emu-val>elements, backtick spans (e.g.,`code`), asterisk spans (e.g.,*"string"*), or after equals signs (as in HTML element attributes).This approach is not perfect, but spec source text tends to strongly avoid the sort of edge cases that would reveal its flaws (e.g., using it as an automated analog of tc39/ecma262#3861 finds only one line to change, in substring—from «If the
"to"suffix is omitted» to «If the “to” suffix is omitted»).