maybe have a look at Closet For Anki which is made by a top anki contributor. this add-on should have best pratctices for modern add-on design. it should offer many, many possibilities.
@ijgnd , Like I told you that I am myself a web developer. I can do this functionality myself once I get proper understanding of how Anki and it’s add-ons work. Since I have not contributed to an open source project like this I am finding it difficult to start. Just guide me on how to start and which all documentations to refer to save time.
You don’t really need any open source experience to start developing add-ons.
You can just duplicate the folder of an arbitrary add-on (within addons21) as a starting point for your own stuff.
Like @ijgnd said, Closet for Anki covers a broad range of functionality and its source code is a great reference for best practices of add-on development (also for the JavaScript part).
When I create a table and then copy and paste it into another field so that I don’t have to retype all the headings, the table gets bigger. I know this is a minor thing, but when I have two variations of the same table on the same card, the tables aren’t the same size. Even the text isn’t the same size between the two tables, even though the styling part of the card template doesn’t contain anything that should change the size of the text. Any suggestions?
@Annapox: Anki is very flexible so a problem can be introduced in many different places. Do you see the review just when you are reviewing cards or do you also see this in the editor when you make a new note (or check it at the bottom of the browser)? If it’s just during reviews check your card styling in your card templates - there are some good youtube videos on this …
If it’s about the editor in the add/browser window: try without add-ons and check the font size you set for each field (that you see when you click the fields button in the upper left of the editor).
Ultimately you can check the html source code of both tables: in the editor put the cursor in a field and press ctrl+shift+x to see it (on macs it’s cmd+shift+x). Then compare the source code for both fields if there’s a difference. If there’s no difference it’s not about my add-on. Then at some place else different styling gets applie (most liekly cause for reviews it’s somewhere in the card templates).
The difference does also show up in the editor. I don’t see anything in the card styling or the editor settings that would cause the two tables to be different, but I did find a difference in the HTML code.
The original table starts with:
The copy starts with:
So now I know how to get all the tables looking the same, but any ideas how that would have happened in the first place? I haven’t messed with any of the code for the tables or for the add-on itself.
try this: cut a table from a field and paste it into it. Does this change the table? When you paste something into anki anki processes it which may slightly change how it looks.
ideally this shouldn’t happen so maybe there’s something in my add-on to fix. But it’s much easier for me if you show me html source code that leads to this problem.
Sorry, I did copy and paste it the code snippets that were different, but I forgot to use the “preformatted text” button. I’m having an off day, I guess. Let’s try this again. The original table starts with:
So, I can fix it by changing the code so that it matches, but there’s still the question of why that change happens in the first place. For what it’s worth, if I copy and paste the copy of the table, the code of the new copy is identical to the code of the first copy, as far as I can tell.
I see. I’ll look into it in the coming weeks (when I’m less busy at work). In the meantime you could use my editor: paste raw unfiltered full html - AnkiWeb or if you don’t want more add-ons copy the html source from field a into the html source editor of field b - this avoids that anki processes (cleans) the input
Since ~2.1.20 when you copy and paste a table the styling seems to be removed by Anki fully. Annapox has a different problem: when pasting some styling is changed and not removed, e.g. the width is changed from relative to an absolute value. This reminds me of a problem I had with Custom Styles where css got changed to inline styling by chrome’s inserthtml. Maybe something similar goes on here.
The fact that coyping and pasting between fields removes stuff is not that unusual, e.g. only on MS Windows some hyperlinks made by another add-on got removed, see here.
Hi @ijgnd , quick question: You don’t yet save the configuration of this addon in the user_files-folder, correct? If you don’t, this would probably be a useful addition so we don’t have to recreate our settings after each update.
@basiskarten: When you update an existing add-on either by checking on ankiweb for updates or by dragging and dropping a ankiaddon file in the add-on dialog your custom config is kept.
That’s my experience and I just looked at the code. This behavior should be due to this:
This line should read the old config (meta.json), then one line later the old folder is deleted and then about 5 lines down the new meta (after updating it with your old config) is written into the newly installed folder.
As far as I see you keep custom versions of your recommended add-ons and install them with a helper add-on of yours. This could be related to losing custom configs on your add-on updates.
I uploaded the same addtable version to ankiweb a week ago for all anki versions. Once you’ve created different versions of an add-on on ankiweb you can’t merge them back. The only thing I know to do is upload the same version multiple times.
The add-on should work with 2.1.15+ (at least with the version on ankiweb that was built with qt 5.12). I’m not sure if it works with much older anki versions or linux distros that rely on much older qt versions.
Since few people actually report bugs maybe you shouldn’t test for yourself (since you’re doing this commercially). But i haven’t gotten any bug reports over the last 8 days.
Unfortunately I don’t really understand your problem
At the bottom of your post there’s a screenshot of the dialog my add-on shows. In this there’s a line styling that for you shows “basic - full width”. Change this to “basic - minimal width”. Also make sure that at the bottom of the dialog you check “Save these settings as”. Then insert a table. This should make the add-on remember this setting so that when you transform selected text with markdown table formatting you’ll get a table that’s narrow