When pasting code blocks, asterisks don't seem to be handled correctly

I’ve just noticed this issue, and couldn’t see any other mentions of it.

When pasting Markdown content that contains code blocks, whether fenced or inline, the asterisks get stripped out. This is an issue because the asterisks can be meaningful parts of the code, so it’s easy to miss that crucial information is being lost.

Here’s an example, with the Notion source on the top and the result of pasting into Anytype below:

The asterisks are preserved in [the Markdown Notion is putting on the clipboard](https://i.imgur.com/BXAHvGO.png).

Pasting the Markdown from a text editor preserves the asterisks (and the language flag for fenced blocks, which pasting from Notion doesn’t), [but doesn’t trigger the Markdown rendering](https://i.imgur.com/CnRGx7M.png).

This is on Windows 10 (19042) with Anytype 0.18.28.
Note by @Flip: Still in 0.29.0

[Here’s the Notion page, if anyone wants to try it and see what happens on other platforms.](https://www.notion.so/ryanplant/Inline-code-example-539872e160534f4ea4a506fa81179727)

2 Likes

I’ve just realized that this isn’t strictly a pasting issue. Inline code blocks seemingly cannot contain things like def __init__ (although fenced code blocks are fine). I think the expected behavior would be that characters within code blocks are not interpreted as special/formatting characters.

@triangles Thank you for your notice! It has been added to the bug tracker

Hey @triangles, I checked this with the content of your notion page. Everything I pasted into an Anytype code block seemed to preverse all characters. So I would say that this was fixed.
Would you check it on your side?

This is still a bug. In general asterisk characters are not handled correctly in text. You cannot have two asterisks in the same text as they disappear.
This is reproducible in the newest version 0.25.4 on Mac.
Steps to reproduce:

  1. Copy the following text:
    This is the address 192.168..
    What I cannot type is two asterisk in the same text.
    Maybe a new line this is the way
    ?
  2. Paste into Anytype page.

Expected result: Asterisks are in the text
Actual result: Asterisks disappear

Edit: This forum behaves the same way, you cannot type two * in the text.

Could you paste a screenshot of the text you wanted to paste?

@dziczyzna @triangles
Seems to be fixed in the current version.

@Flip I updated to 0.27.0 and on my Mac the issue still exists.

1 Like

Yes, two asterisks in text would become italicised text as it is parsing them as a markdown. I will think of any solution.