joplin-plugin-better-code-blocks icon indicating copy to clipboard operation
joplin-plugin-better-code-blocks copied to clipboard

Plugin automatically formats code blocks when viewing note

Open jgusta opened this issue 1 year ago • 1 comments

When the better code blocks plugin is installed and rendering is active, the formatter is automatically run when a note is opened. This causes the updated date to update on notes that are affected. Obviously making changes to a note simply by viewing it is undesirable.

I'll take a look at the code briefly in case anything pops out.

jgusta avatar Oct 05 '24 22:10 jgusta

Is this happening when you're opening older notes that weren't ever formatted by the plugin? I can't reproduce this when opening notes that were already formatted in the past.

The plugin adds newlines before and after each code block and adds a newline to empty ones. This allows for cursor placement around and inside code blocks, since the cursor cannot be placed next to the opening and closing code fences (```).


I'm currently rewriting this plugin for the updated Joplin markdown editor, which should hopefully address this. I'm looking to allow cursor placement before the opening code fence and after the closing code fence. This will make it so the plugin no longer needs to add the newlines before and after each code block.

ckant avatar Nov 08 '24 01:11 ckant