friedrich-de / Basic-Mining-Deck

Mining Deck Template
34 stars 5 forks source link

I have this issue when creating new cards, any idea? #7

Closed HipstaWhale closed 5 months ago

HipstaWhale commented 5 months ago

Invalid HTML on card: SyntaxError: Invalid or unexpected token SyntaxError: Invalid or unexpected token at eval () at http://127.0.0.1:63307/_anki/jquery.js:2:2651 at Function.globalEval (http://127.0.0.1:63307/_anki/jquery.js:2:2662) at Ha (http://127.0.0.1:63307/_anki/jquery.js:3:21262) at n.fn.init.append (http://127.0.0.1:63307/_anki/jquery.js:3:22791) at n.fn.init. (http://127.0.0.1:63307/_anki/jquery.js:3:24070) at Y (http://127.0.0.1:63307/_anki/jquery.js:3:4515) at n.fn.init.html (http://127.0.0.1:63307/_anki/jquery.js:3:23660) at HTMLDivElement. (http://127.0.0.1:63307/_anki/reviewer.js:33:16) at HTMLDivElement.d.complete (http://127.0.0.1:63307/_anki/jquery.js:4:6203) Screenshot 2024-02-23 194921

HipstaWhale commented 5 months ago

Also this happened after updating the fields, is it because I'm on an older version of Anki? I'm on 2.1.35

friedrich-de commented 5 months ago

I don't think the Anki version matters. Although Yomichan/Yomitan and the loaded dictionaries might.

Are all cards broken or only new ones you mine? What did you mean by "updating the fields"? If all cards are broken you may have changed the formatting of the card accidentally in some breaking way. If only new cards are affected it's possible you loaded a dictionary that breaks the code by importing some sort of non-standard info in fields it's not supposed to.

If you can verify that the card format itself works, it's probably imported information. In that case it might be worth taking a look at what raw data is in the card fields that might cause this error and checking if it's associated with a dictionary.

friedrich-de commented 5 months ago

Also general recommendation: I'd try to keep everything updated. Entire setup works for me with Anki, AnkiConnect, Yomitan and so on on the newest version.

HipstaWhale commented 5 months ago

Just updating the front, back and styline fields from ur files

friedrich-de commented 5 months ago

Just did the same to verify the files are correct and I get no error. Maybe you accidentally copied something wrong/forgot to overwrite something or have things double? Make sure to replace all text. There were no significant changes so if it worked previously there is no reason it shouldn't work now.

HipstaWhale commented 5 months ago

It worked before I updated the fields, really made sure I copied it correctly for good measure as well. Should I try updating anki?

friedrich-de commented 5 months ago

You are free to try, but I don't think it will change anything. The error seems to suggest that there is an error in the card formatting (especially if you say it happened after you replaced the info) but from what I can tell there is no issue with the code. Could be that you copied it incorrectly or maybe your notes have info that break them.

Try downloading the deck from AnkiWeb (you might need a new profile if you already imported it once/have existing cards with it). Does it work? If yes, replace the front, back and styling with what is in the files. Does it still work?

HipstaWhale commented 5 months ago

I did some troubleshooting and it seems that it doesn't work when I have Japanese text in my clipboard? As in when I ctrl+c

HipstaWhale commented 5 months ago

It works with english text it seems

HipstaWhale commented 5 months ago

You are free to try, but I don't think it will change anything. The error seems to suggest that there is an error in the card formatting (especially if you say it happened after you replaced the info) but from what I can tell there is no issue with the code. Could be that you copied it incorrectly or maybe your notes have info that break them.

Try downloading the deck from AnkiWeb (you might need a new profile if you already imported it once/have existing cards with it). Does it work? If yes, replace the front, back and styling with what is in the files. Does it still work?

Ill give it a try

friedrich-de commented 5 months ago

I did some troubleshooting and it seems that it doesn't work when I have Japanese text in my clipboard? As in when I ctrl+c

Okay, that's quite a bit more concrete. Japanese text itself/text copied over by clipboard doesn't break the cards in any way. What's the raw text that is in the field that causes it to break?

HipstaWhale commented 5 months ago

Actually it doesn't seem like Japanese text, it seems like it doesn't work when copying texts from different lines.

例えば、“教師は厳しい”っていいよ、 でも: ”教師は 厳しい”ってだめ

I may have copied some texts with multiple lines? That's my final conclusion. I think my issue is fine, I'm now just wondering about the pitch graphs and the images, do I have to manually input those? Cause they don't show up for me

friedrich-de commented 5 months ago

image

Multi-line text doesn't break it either. It's probably something else, you have to click this button to show the raw text.

Pitch accent graphs are automatic if you put in the correct field information in Yomichan and have imported this pitch accent dictionary: https://github.com/toasted-nutbread/yomichan-pitch-accent-dictionary/releases/tag/1.0.0

Images you will have to paste yourself, yeah. Screenshot tools support copying to clipboard and you can open the card with the Yomichan/tan link, so it's a matter of 2 seconds if you've got it properly set up.

HipstaWhale commented 5 months ago

Okay thanks, image addition isn't a dealbreaker for me and I'll try importing the pitch accent dictionary. I'll do more troubleshooting for you, thanks for helping me out

HipstaWhale commented 5 months ago

Also is that option new? Cause I don't seem to have it on my Anki

image

Multi-line text doesn't break it either. It's probably something else, you have to click this button to show the raw text.

Pitch accent graphs are automatic if you put in the correct field information in Yomichan and have imported this pitch accent dictionary: https://github.com/toasted-nutbread/yomichan-pitch-accent-dictionary/releases/tag/1.0.0

Images you will have to paste yourself, yeah. Screenshot tools support copying to clipboard and you can open the card with the Yomichan/tan link, so it's a matter of 2 seconds if you've got it properly set up.

friedrich-de commented 5 months ago

Also is that option new? Cause I don't seem to have it on my Anki

image Multi-line text doesn't break it either. It's probably something else, you have to click this button to show the raw text. Pitch accent graphs are automatic if you put in the correct field information in Yomichan and have imported this pitch accent dictionary: https://github.com/toasted-nutbread/yomichan-pitch-accent-dictionary/releases/tag/1.0.0 Images you will have to paste yourself, yeah. Screenshot tools support copying to clipboard and you can open the card with the Yomichan/tan link, so it's a matter of 2 seconds if you've got it properly set up.

Could be. In older version of Anki you might have to edit the field and check a box that says to display raw HTML.

HipstaWhale commented 5 months ago

I can't seem to figure it out, it's not too much of an issue for me so I think I'll be fine. Thanks for your help.

friedrich-de commented 5 months ago

Marking this as closed then.

HipstaWhale commented 5 months ago

Thanks got everything working. For yomi chan I used this line from jpmining for the Sentence field and it worked out: {cloze-prefix}{cloze-body}{cloze-suffix} Screenshot 2024-02-24 004505

HipstaWhale commented 5 months ago

Thanks again, your template is actually a lifesaver for me 🙏

friedrich-de commented 5 months ago

Never seen that cloze stuff, but good for you if it works. Glad if the template helps. I would be careful to not overengineer your cards as it doesn't really help with learning the language.