abul4fia / teletolo

Telegram To Logseq
19 stars 1 forks source link

Messages containing "-" are broken down #1

Closed goldan closed 2 years ago

goldan commented 2 years ago

First of all, thanks for a super helpful script. It works great! I've been able to move thousands of saved messages in Telegram over 8 years to Logseq.

I found a few minor bugs. Here is one:

Example

Telegram (it's one message):

A

becomes in Logseq:

I have block_fmt = {message} {tags}

So the message is broken in 3, and the tag is only assigned to the last one.

Ideally, the message would stay as one block, with the tag assigned to it as usual.

abul4fia commented 2 years ago

Thank you for your interest in this little tool of mine.

The problem with - inside a telegram message was that those characters were passed untouched to the markdown output, so logseq interprets them as new items in its oultine.

I think the fix is to replace them by *, which for markdown is equivalent to -, but not for logseq which uses only - as item mark (indeed, using * is the only way to have bullets inside a logseq paragraph).

I added some regex processing to replace those - by *. I hope that this does not cause new issues in other contexts. Only the - which appears as the first non-blank character in a line are replaced, so I think this is safe.

goldan commented 2 years ago

thanks!