anki icon indicating copy to clipboard operation
anki copied to clipboard

Remove '<h2>' when passing to Anki

Open rubisco57 opened this issue 1 year ago • 4 comments

Thank you for sharing this plugin!

I would like to remove the h2 tag resulting from the usage of markdown level 2 headings as card separator. It is nice for visual display in vscode, but ugly on the flashcards. Mapping ## to another tag in the conversion or just nothing, would be a good solution. Could you provide some build instructions? I could not get it to work, as it is the first time I am using esbuild.

rubisco57 avatar Jul 20 '22 17:07 rubisco57

Mapping ## to another tag in the conversion or just nothing, would be a good solution.

I think you're right, we can probably just map it to nothing which may be better than a H2. Looks like we already do this for cloze cards so could probably just do it across the board.

I could not get it to work, as it is the first time I am using esbuild

You shouldn't need to do anything special with esbuild, just:

  • $ npm install
  • $ npm run watch
  • Make sure Anki is up and running
  • in VSCode go to debug and launch "Run Extension"

This should give you access to a debug view, you may need to disable the production version of the extension while you do this. Once the above works you can start off by breakpointing here https://github.com/jasonwilliams/anki/blob/main/src/markdown/parsers/cardParser.ts#L61

jasonwilliams avatar Jul 20 '22 17:07 jasonwilliams

Thank you for your time, @jasonwilliams, and for guiding me in compiling my first VSCode extension. The Anki cards now follow the standard format.

rubisco57 avatar Jul 21 '22 10:07 rubisco57

@rubisco57 you don't want to offer a PR to have it fixed upstream?

jasonwilliams avatar Jul 21 '22 17:07 jasonwilliams

This is now in https://github.com/jasonwilliams/anki/releases/tag/v1.3.0

jasonwilliams avatar Jun 12 '23 22:06 jasonwilliams