gregorias / anki-code-highlighter

Anki plugin for code syntax highlighting.
GNU Affero General Public License v3.0
54 stars 3 forks source link

line brakes disappear while pasting codes #43

Closed Hosseingsd closed 1 year ago

Hosseingsd commented 1 year ago

when i copy multiple lines of code and paste it to existing code box, all the line merge into just one long line and i have to delete all breaks and replace it with shift+enter key (using shift+enter is not big deal while typing codes from scratch but after pastin codes it's a tedious process). how to prevent this in the first place?

p1

gregorias commented 1 year ago

Could you provide step by step instructions to reproduce what you mean and what the expected behaviour is?

Hosseingsd commented 1 year ago

0

1

2

4

5

I want pasting in step 4 give me the desired result in the last image, automatically.

gregorias commented 1 year ago

You are pasting with HTML breaks (<br>), which get ignored by the highlighting mechanism. This addon is only meant to highlight plaintext codeblocks.

To address this, you should consider pasting unformatted text (e.g., CMD+SHIFT+V on macOS) or manipulating the HTML directly.

Hosseingsd commented 1 year ago

Cttl+Shift+V does not help

gregorias commented 1 year ago

Alright. Could you fill out a bug report and include the information it asks you for? Especially the field's HTML code.

Hosseingsd commented 1 year ago

Alright. Could you fill out a bug report and include the information it asks you for? Especially the field's HTML code.

I'm not familiar with GitHub process. (and I'm not a programmer). Do what you think is best.

gregorias commented 1 year ago

Please fill out a bug report. The template will guide you to give us the information needed to debug this. It's especially important provide the HTML code of your fields.

Hosseingsd commented 1 year ago

I'm not a programmer but I'm learning. today I learned something about <pre> tag. can't you implement this tag to solve this problem? It's just an idea and I don't know how! I'm an absolute beginner!

this is an example of using <pre> tag (this is not an image from Anki): code pre br