chalk.ist icon indicating copy to clipboard operation
chalk.ist copied to clipboard

feat: add ability to annotate errors and warnings

Open paoloricciuti opened this issue 4 months ago • 4 comments

Closes #70

I've took the liberty to open a pr for my feature request. It was a bit of hard to figure out a good UX for this but i think overall is not bad:

https://github.com/user-attachments/assets/d0a2edcc-aa1e-4f07-8bec-34ccfd391fc8

You can select portion of the text and press E or W to add an error/warning...the C button clears all the errors and warnings ~(it would be cool to have the ability to clear only a specific one but I wonder how that would look like (maybe if there's a selection only removes the ones in the selection?)~ actually i just updated the PR to do exactly this

Here's the resulting image.

Some notes

  1. I needed access to the editor textarea within the footer...not sure what the best practice for this is in vue but i resorted to setting context in Window and accessing it both from the editor and the footer. I've used a pattern we use quite often in svelte to create typesafe contexts.
  2. I had to create a shiki transformer for this, this adds an extra div to only show the squiggles...this does mean some extra elements but i think it's fine
  3. I had to update the persisted store to store the marks, i did it in a back compatible way so it shouldn't cause trouble
image

Let me know if there's something you wish to change (and thanks for this awesome tool)

paoloricciuti avatar Aug 08 '25 09:08 paoloricciuti

@paoloricciuti Thanks for PR! What you think about putting it in toolbar which shows when you select text? CleanShot 2025-08-08 at 13 27 38@2x

Idered avatar Aug 08 '25 11:08 Idered

@paoloricciuti Thanks for PR! What you think about putting it in toolbar which shows when you select text? CleanShot 2025-08-08 at 13 27 38@2x

Mmm this might be a good idea... I'll check how feasible it is to do...would you also put the clear there? I think have a clear all would still be good and that should be always on without the need to select text

paoloricciuti avatar Aug 08 '25 11:08 paoloricciuti

Pushed a change to move the buttons in the toolbar...I did something like this but if you have suggestions in terms of styling feel free to ping 😄

image

paoloricciuti avatar Aug 08 '25 13:08 paoloricciuti

Hey @Idered any chance for this to be merged?

paoloricciuti avatar Oct 13 '25 08:10 paoloricciuti