Skip to content

Add symbols to unicode punctuation - #739

Merged
jgm merged 2 commits into
commonmark:masterfrom
wooorm:symbol
Aug 9, 2023
Merged

jgm merged 2 commits into
commonmark:masterfrom
wooorm:symbol

Conversation

@wooorm

@wooorm wooorm commented Jun 26, 2023 •

Copy link
Copy Markdown
Contributor

The current commonmark definition of “ASCII punctuation character” does not only include the unicode punctuation characters within the ASCII range, but also the unicode symbol characters within the ASCII range: $, +, <, =, >, ^, `, |, ~.

I think this makes sense. I think that users would not know the difference, and would indeed expect to be able to escape * the same as $.

I think it is also sensical to broaden the definition of unicode punctuation the same way, so that there’s no difference between $, £, and €.

Currently:

*$*a.

*£*a.

*€*a.

*$*a.

£a.

€a.

(EDIT: if GH supports this PR, the emphasis does not work in the above 3 cases, when it doesn’t, emphasis works for £ and € but not for $)

Proposed: none turn into <em>s (note this is not a useful example, I am sure it could be possible to come up with a better one).

Note, S (symbol) includes the subgroups:

gc ; Sc                               ; Currency_Symbol
gc ; Sk                               ; Modifier_Symbol
gc ; Sm                               ; Math_Symbol
gc ; So                               ; Other_Symbol

Note, all unicode characters, all unicode categories

The current commonmark definition of “ASCII punctuation character” does not
only include the unicode punctuation characters within the ASCII range, but
also the unicode symbol characters within the ASCII range: `$`, `+`, `<`,
`=`, `>`, `^`, `` ` ``, `|`, `~`.

I think this makes sense. I think that users would not know the difference,
and would indeed expect to be able to escape `*` the same as `$`.

I think it is also sensical to broaden the definition of unicode punctuation
the same way, so that there’s no difference between `$`, `£`, and `€`.

Currently:

```markdown
*$*a.

*£*a.

*€*a.
```

*$*a.

*£*a.

*€*a.

Proposed: both do not turn into `<em>`s (note this is not a useful example,
I am sure it could be possible to come up with a better one).

> Note, `S` (symbol) includes the subgroups:
>
> ```
> gc ; Sc                               ; Currency_Symbol
> gc ; Sk                               ; Modifier_Symbol
> gc ; Sm                               ; Math_Symbol
> gc ; So                               ; Other_Symbol
> ```
wooorm added a commit to micromark/micromark that referenced this pull request Jun 26, 2023
When considering whether attention (emphasis, strong) will work, CommonMark
currently treats ASCII symbols (such as `$`) and Unicode symbols (such as `£`)
differently.
This matches that.
See also: commonmark/commonmark-spec#739.
@jgm

jgm commented Aug 4, 2023

Copy link
Copy Markdown
Member

I'm in favor of this change -- does anyone see a problem with it?

@rlidwka

rlidwka commented Aug 5, 2023

Copy link
Copy Markdown
Contributor

This needs an example in the spec, otherwise parsers that use spec as compliance tests might miss the change.

@wooorm

wooorm commented Aug 9, 2023

Copy link
Copy Markdown
Contributor Author

added a test case!

Comment thread spec.txt
````````````````````````````````


Unicode symbols count as punctuation, too:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the position of the case and this line are due to the test before it, which reads “Unicode nonbreaking spaces count as whitespace, too:”

@jgm
jgm merged commit ac99739 into commonmark:master Aug 9, 2023
@wooorm
wooorm deleted the symbol branch August 9, 2023 19:16
wooorm added a commit to micromark/micromark that referenced this pull request Jan 28, 2024
This only really adds Unicode symbols to where Unicode punctuation also
works.
Which is only affecting whether emphasis/strong “forms” or not.
Which basically means that `*$*` now works the same as `*€*`.

See commonmark/commonmark-spec#739.
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.

3 participants