Add Table [Official thread]

I always use this add-on to make a table. Thanks for your work. But it seems to have a bug. When I change the Config such as "table_style__column_width_fixed_default": true,(change the true into false).But there is a width: **%; in the result HTML. Could you fix it?

ps:I’m in the Anki V2.1.44

@zyd199012: thanks for notifying me. But I can’t reproduce this problem at the moment.

Could you test again with the latest Anki version (2.1.44) and just the add table add-on. If the problem persists: Share you whole config of my add-on and show which boxes you had checked in the dialog before inserting a new table (screenshot). This should allow me to reproduce the problem which makes it much easier to fix it.

Hello, is it possible to avoid using header rows? If not, would it be possible to add this option? I know that you can somewhat hide it with CSS, but I’d rather do it natively
Thank you very much!

@aPaci: There’s an option “First row is head” that you can uncheck in the dialog that opens when you click the table button in the anki editor.?

Yes, that works perfectly; i was trying to do the same thing with the automatic table creation. For example:
test | test
test | test
always makes the first row as head
Is there any way?

Hi @ijgnd , just a quick heads up: The Add Table-Addon gets deactivated automatically under Anki 2.1.45, even though it seems to be fully compatible with it. I’m currently testing the RC1 of this new version:

Same goes for Add Hyperlink, also a basic addon that is probably used by many people.

If I remove or adjust the "max_point_version": -44 setting in meta.json both addons work just fine. I played around with both and had no issue at all.

It is probably a good idea to adjust this setting before the new version of Anki gets released, otherwise many people will be left wondering what happened to these buttons they so often use. :+1:

@basiskarten: Thanks for the info.

tldr: update your add-ons and restart

long version: I have uploaded slightly changed versions for the table and hyperlink add-on recently. In case I introduced bugs I didn’t want to have the update delivered to everyone right away. So I uploaded these new versions just for 2.1.45+. When you update anki it does not directly check for add-on updates on the first start (at least until .44). That’s a known limitation (see here) and I guess that you’ve run into it. I still didn’t have time to look into this.

To test if this explanation applies here: Could you manually rewrite the meta.json to “-44”, restart Anki, and then check for add-on updates?

btw: the biggest change was in the table add-on how it transforms text that’s separated by | (for details see here). If you run into a problem with this in the new version for 2.1.45 let me know.

1 Like

Got it, thanks. Yes, if I look for updates indeed it tells me that some are available and if I do update I get the new versions and everything’s fine.

To be sure: The only reason for restricting it to .45 was to test it on a limited number of people, not some known incompatibility to previous versions, right?

The reason I’m asking is that I deliver both the “Add Link”- and a slightly modified version of the “Add Table”-Addon via my Butler-addon. It was good to me that both are very stable since otherwise my modified version would get overwritten a lot. (The only change in the modified version is that all tables would get an additional class called “user_tabelle” which is used in all of my note types.) Maybe it’s best to break the automatic updates for the add_tables-addon so this doesn’t happen. Anyway, are there any other changes planned in the future?

  • indeed, the only reason for restricting it to .45 was to test both of them on a limited number of people.
  • I don’t really plan major updates for either add-on. For the table add-on maybe at some point to use a markdown library to transform the text to a html table. But I haven’t made the change in the last year so there’s a good chance I’ll never make it - especially since hgiesel (who has rewritten the editor) recently mentioned “Table editing will probably be implemented at some point”, see here.
2 Likes

Hi, So I am new to this anki applications but since I am a developer having knowledge of html,css,JS and Python I can edit it but I need a starting point. So I want to change this Add table plugin to accomodate for match the following quiz type which returns answers you matched correctly as shown

I know that I can edit the card type and add html input field for that. But I am not sure how to do the javascript part of it as I have not worked on Anki javascript till now.

@ak47: I can’t really help with this. I would look at other add-ons or card type templates that offer multiple choice like functionality, e.g.

maybe make a new topic in the add-on or development category of this forum so that you get more visibility.

@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).

There’s also an official guide (explains the use of hooks, collection operations etc.): Introduction - Writing Anki Add-ons

And I consider AnkiWebView Inspector - AnkiWeb essential for my personal add-on development.

@ak47: Since I don’t really understand what you want from me there’s a good chance that you won’t like this link either: https://www.reddit.com/r/Anki/comments/bae3yx/building_addons_without_reading_all_the_source/ekazvjd/ Hopefully there’s something useful for you. Some people said that found this collection useful.

2 Likes

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?

Thanks!

@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.

you didn’t post the html source code.

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:

<table class="table_class_basic_full_width" style="font-size: 85%; width: 100%; border-collapse: collapse; border: 1px solid;">

When I copied and pasted the table into another field, that code changed into:

<table class="table_class_basic_full_width" style="width: 822px; border-collapse: collapse; border: 1px solid;">

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