TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.98k stars 1.18k forks source link

Support single-character escaping #1648

Open reflectionalist opened 9 years ago

reflectionalist commented 9 years ago

Summary

This is related to issue #1473. But as @grayeul has hinted, the two issues are different, #1473 at token level while this one at character level.


Currently, there exist at least two syntactic elements in TiddlyWiki that allow escaping some text from being marked up. One is ~ to escape from wiki link, the other is """ to escape from joining broken lines. Issue #1473 proposes yet another one.

Possible choice for the syntax could be \c or ~c. I personally prefer the former because of its Unix origin. But given that backslash is already used in macro keywords and that ~ is already in use to escape wiki link, the latter is probably more to TW.

Once single-character escaping is supported, """ can be kicked out (alas for backward-compatibility).


I never liked """, imagining that when you want to insert a hard line break, you have to either appeal to the HTML <br/> or are forced to put these lines in a block.


When you want a hard line-break, put a \ at the end and follow it with a line break. It escapes line break! The situation is reversed compared to Unix systems, where you put a \ before a line break to supress line break, while here we use it force line break.

For wiki link, it could be taken to mean that it escapes the first capital letter. For issue #1473, at least we have a low character-level work-around, simply escape the wiki markup syntax character by character, say \'\'light\'\'. Issue #1607 is also resolved, simply write \[[[Foo]]\], no need to add a new parsing rule for demand of escaping in this or that situation.

I believe the advantage of supporting single-character escaping is immense. Regarding @Jermolene's concern about users' inability to use the escaped character in most case, I completely agree with @grayeul, that it is irrelephant ;) since whether or not single-character escaping is supported, you can not use special symbols used for wiki markup plainly wihtout, well, escpaing it, anyway.

pmario commented 9 years ago

Multi platform escaping is a nightmare!

\ backslash may be convenient to use for an escape mechanism in unix systems, because it isn't used very often. In Windows it is used everytime you write a file path. So how should I write c:\my\path\to\tiddlywiki.html?

IMO 80%+ of TiddlyWiki users use Windows as there main OS for PCs.

A common undo for the escape sequence is to double it. Like: c:\\my\\path\\to\\tiddlywiki.html ... but that's not possible, because several (5) backslashes are a valid sequence.

Let's have a look to a win network path: eg: file:\\\\\COMPUTER_NAME\Users\Mario\Pictures\2010-10\ is a valid path for a shared network drive. ... So how should we escape-escape it and explain the mechanism to our users?

To drive escaping into insanity we could try to create a js regexp search for file:\\\\\COMPUTER


I believe the advantage of supporting single-character escaping is immense.

I'm not sure about this. IMO we will have less problems, without it.

Regarding @Jermolene's concern about users' inability to use the escaped character in most case, I completely agree with @grayeul, that it is irrelephant ;) since whether or not single-character escaping is supported, you can not use special symbols used for wiki markup in plainly wihtout, well, escpaing it, anyway.

IMO Jeremys concerns are very true and we have to think 3 times, if we really want to implement it. Especially we have to have a look on the big picture for all OSes used with TW.

reflectionalist commented 9 years ago

@pmario

Thanks for pointing out the platform issue I overlooked. Windows users are recommended to put their paths inside a pair of backquotes ```. ;)

Jermolene commented 9 years ago

I think one of the important use cases for the triple double quote syntax is poetry. Compare:

’Twas brillig, and the slithy toves\
Did gyre and gimble in the wabe:\
All mimsy were the borogoves,\
And the mome raths outgrabe.

“Beware the Jabberwock, my son!\
The jaws that bite, the claws that catch!\
Beware the Jubjub bird, and shun\
The frumious Bandersnatch!”

And:

"""
’Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.

“Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!”
"""

But that obviously doesn't invalidate the idea of a single character escape that works for all wikitext constructions, I agree that it might be useful in some situations.

tobibeer commented 8 years ago

:-1: => too many false positives

What single character could be elevated to that degree? What exactly is being escaped and why?

Jermolene commented 8 years ago

Hi @tobibeer isn't there another discussion somewhere else about adding a single character escape?

tobibeer commented 8 years ago

If you refer to #1473, I think it's about not-wikifying chunks of text, rather than doing it on a character / word basis.

pmario commented 7 years ago

@reflectionalist ... The hard-linebreak problem can be solved, if PR #2737 would be merged. So you may support it with +1! also have a look at the linked example

pmario commented 6 years ago

@reflectionalist ... PR #2737 has been merged. Can you test the possibilities and close the issue if it works for you.

Please also respond, if it is still an issue!