adifyr / obsidian-chat-view

An elegant chat view for Obsidian pages.
MIT License
202 stars 11 forks source link

Escaping special characters #22

Closed EricKotato closed 1 year ago

EricKotato commented 1 year ago

Is there a way to escape the vertical bar character |, so it can be shown in message?

Addressing escaping "less than" sign < in html tags would be also good, but it can be escaped by enclosing it in accents (`<`) while vertical bar can't be escaped at all.

adifyr commented 1 year ago

Hi @EricKotato. Thanks for the feedback. Chat View V2 is currently in the works. I am thinking of replacing | with ~ which is a rarer character and overall simplifying the text interface.

This may be a slightly long term issue, will post updates here as the development cycle progresses.

EricKotato commented 1 year ago

Changing the character will break existing dialogs. With few dialogs it could be fine, but with many dialogs it would be certainly painful.

Using | itself as a part separator is fine, but the way to escape a character would be great, and I don't think that simply changing the character would help since I saw people using ~ as postfix very frequently.

adifyr commented 1 year ago

V2 will incorporate more changes than simply a character change. And not to mention, I'll take care of backwards compatibility as well. But, thanks for the feedback on which character is used frequently.

I'll see if I can give an escape sequence for the character in the meantime. Perhaps something like \| can be parsed as |. I'll get back to you on the same.

adifyr commented 1 year ago

Hi @EricKotato. I've published a fix to this issue with the release of Version 1.5.1 of Obsidian Chat View. You will now be able to safely escape | pipe characters by adding a \ backslash in front of it.

Kindly confirm if this has been resolved on your end so that I may close the issue.

EricKotato commented 1 year ago

Looks like something broke.

This code:

```chat
< test message 1
> test message 2

Now results in this:
![](https://user-images.githubusercontent.com/2903496/211229505-775b7b1e-38eb-4f26-b2aa-929fe314506a.png)

Even this code:
< | test message 1
> | test message 2

Is now this:
![](https://user-images.githubusercontent.com/2903496/211229617-17fa2de8-8893-4215-aaa0-6c770a60bacf.png)

Even if I fill all fields:
< A | test message 1 | time
> B | test message 2 | time


It's shown like this:
![](https://user-images.githubusercontent.com/2903496/211229746-0d07fcfa-5649-44e0-bb88-a3445bf4a845.png)
EricKotato commented 1 year ago

Escaping, on the other hand, works as expected now:

Code:

```chat
< A | test \| message 1 | time
> B | test \| message 2
adifyr commented 1 year ago

@EricKotato Ahh, nice catch. I forgot to remove the arrows in the beginning. Hold on, I'll issue a fix right away.

adifyr commented 1 year ago

I've just issued a fix in Release of Version 1.5.2. Can you check whether the bug has been fixed on your end? I'll close the issue subsequently.

EricKotato commented 1 year ago

Yes, works as expected now. Thanks!