element-hq / element-meta

Shared/meta documentation and project artefacts for Element clients
73 stars 12 forks source link

don't interpret underscores to mean 'italic' when used in the middle of a word. #1758

Open raboof opened 6 years ago

raboof commented 6 years ago

Description

When displaying a string that contains underscores, such as #_ircnet_#hsnijmegen:irc.snt.utwente.nl, the underscores are removed and the 'ircnet' fragment is shown in italic ("#ircnet#hsnijmegen:irc.snt.utwente.nl").

It would be nicer to leave underscores be when encountered in the middle of a word, and only convert them to italic when they are added on word boundaries.

Version information

For the web app:

t3chguy commented 6 years ago

This is the behaviour of CommonMark

Related https://github.com/vector-im/riot-web/issues/6434 https://github.com/vector-im/riot-web/issues/3534

ara4n commented 6 years ago

dup https://github.com/vector-im/riot-web/issues/4674

raboof commented 6 years ago

I'm not sure this is really a duplicate of vector-im/element-web#4674 because that is specifically about URL's and this is a non-URL string. A fix for vector-im/element-web#4674 may or may not fix this case.

ara4n commented 6 years ago

Yup, you're right - it's actually a regression of https://github.com/vector-im/riot-web/issues/3428. It's probably very similar to vector-im/element-web#4674 but may not be. Will reopen.

lampholder commented 6 years ago

Right, so commonmark (I believe) does the 'right thing' for underscores in the middle of words.

The problem is, it looks like commonmark doesn't consider # a word character: reference impl of commonmark showing the difference.

Fwiw, GFM has exactly the same issue: #ircnet#hsnijmegen:irc.snt.utwente.nl

https://github.com/vector-im/riot-web/issues/4674#issuecomment-355850720 outlines some possible solutions. I'd really like us to stick to an agreed markdown standard; could we address this with some creative pilling (by which I mean turning all aliases to pills and then mandating our own formatting?)

raboof commented 6 years ago

What are/is pills/pilling?