Parse nodeIDs#92
Parse nodeIDs#92jasonwilliams merged 2 commits intojasonwilliams:mainfrom benjamin-weller:parseNoteId
Conversation
|
@benjamin-weller could you explain where these noteIDs come from? Why are they added and what is generating them, the markdown would be hand written most of the time. I may be missing some context here |
|
These note IDs are uniquely generated by Anki. See the note/card ID section of the browser search documentation here. IIUC these IDs uniquely identify the note in question; as such you could eventually update a specific note given its parsed note ID. How I intend to eventually allow for updating of already created notes:
Now that there's a way for us to update notes, I would like to have a way for us to automatically insert the note IDs into the markdown during the deck/note creation command. How I intend to get/insert the note ID into markdown:
|
|
Hey @benjamin-weller great work on making a start on this, I wasn't ignoring, it was just the holidays and I didn't have time to look over this. Hopefully I should have a bit more time now. Thinking about the workflow here... Do you have an idea how this comment will look like? |
|
100% no worries, you've been very responsive before and honestly I have no expectations around super prompt responses, this is OSS; not much money changing hands here.
Yes, that's the ultimate goal
Yes the comment should look like |
| "anki.md.card.notecardIdPattern": { | ||
| "type": "string", | ||
| "default": "<!--\\s*?notecardId\\s*?\\[:=\\]\\s*?(\\d+)\\s*?-->", | ||
| "description": "Text to match match the commented notecard ID." |
There was a problem hiding this comment.
Do we need this to be configurable? I have a feeling if people change this it could become messy.
I'd start off with it being hardcoded
There was a problem hiding this comment.
Ok, yes I guess it could result in lots of questions/mis-configured regexes (and thus lots of github issues).
I'm going making this value just exist in code, I'll add it to a constants file if there is one, or just leave it by the parsing logic if there isn't.
|
Hey @benjamin-weller, maybe im doing something wrong here but could you explain why noteId isn't coming through when I test it? |
|
I've also realised this repo doesn't support proper linting on CI so im going to sort that out. I will PR it, you may need to rebase apologies in advance |
|
Sounds good I'll rebase here. The unit tests pass and that's what I tested against, can you give me a direction as to how to set up your testing environment? Is it like building a trial/test version of the extension and installing that? |
|
Sure https://github.com/jasonwilliams/anki/blob/main/CONTRIBUTING.md#debugging This should launch another instance of VSCode, I used that to test. In the original instance you should be able to set breakpoints and inspect the code |
|
Awesome work thanks, I’ll take another look. Also it seems there’s a conflict with package.json, you may need to try and rebase |
|
Your lockfile causes conflicts, like its trying to set it back to version 1, what version of nodejs/npm are you using? Everything else seems ok |
|
Ok, I'm relatively new to the git flow, please let me know if my changes here match up and can be merged. |
|
LGTM |
|
Hey @benjamin-weller now this is merged what are your next steps? |
|
I've outlined what I intend to do next here. |






This change allows for a parsing of note IDs. This is the first step in allowing (eventually) the automatic storing of the created note ID in the markdown file.