natfarleydev / anki-auto-markdown Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gregorrr/anki-auto-markdown
This project forked from gregorrr/anki-auto-markdown
Currently, when an image is pasted into the editor and then the field is converted to markdown, the image disappears. E.g.
The desired behaviour is that the image stays after converting into markdown.
An upgrade to the markdown library bundled with this addon should be considered
I think there is a regression. Using https://ankiweb.net/shared/info/1030875226 the following correctly converts to a nested list:
* level 1
* level 2
While the version at https://ankiweb.net/shared/info/15061497 does not.
I typed in *test*
into my 'Basic' card which has 'Convert to/from markdown' switched on for the front field. On switching to the back field, this error occurs. I also get it even if I don't use markdown. (input: test
)
Debug info:
Anki 2.1.44 (b2b3275f) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.14.6
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-06-14 14:37:00
Add-ons possibly involved: Auto Markdown - fix version
Caught exception:
Traceback (most recent call last):
File "aqt/webview.py", line 526, in handler
File "/Users/bhampson/Library/Application Support/Anki2/addons21/15061497/editor.py", line 223, in onInnerTextAvailable
updated_field_html = generateHtmlFromMarkdown(field_text, field_html)
File "/Users/bhampson/Library/Application Support/Anki2/addons21/15061497/editor.py", line 28, in generateHtmlFromMarkdown
generated_html = markdown.markdown(field_plain, extensions=[
File "/Users/bhampson/Library/Application Support/Anki2/addons21/15061497/markdown/__init__.py", line 494, in markdown
return md.convert(text)
File "/Users/bhampson/Library/Application Support/Anki2/addons21/15061497/markdown/__init__.py", line 355, in convert
if not source.strip():
AttributeError: 'NoneType' object has no attribute 'strip'
If I click on the Markdown button instead I get this following error. Again, it's the same if I just input test
:
Caught exception:
Traceback (most recent call last):
File "aqt/webview.py", line 526, in handler
File "/Users/bhampson/Library/Application Support/Anki2/addons21/15061497/editor.py", line 137, in onHtmlAvailable
edited_field_html = re.sub(r'<img src="(.*?)".*?>', r'![An image](\1)', field_html)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
Desired outcome: github actions pick up on syntax problems (e.g. extra tabs instead of spaces) and basic linting, excluding external libraries.
It can be tricky to edit and run Anki addons as they use the Python interpreter bundled with Anki. This means it's not possible to run the usual helpful editor plugins since they need a version on the system to run off of. Using CI for linting/syntax checking should help alleviate simple problems before uploading them to AnkiWeb.
When code blocks are copied from online, often they include <pre>
and <code>
tags which are not stripped when converting to Markdown.
They should be removed when converting from field_html
to markdown
Desired outcome: When a tag is pushed to this repo, the anki plugin is automatically built and then uploaded to AnkiWeb, with the description read from a file (e.g. description.html.j2
) and uploaded with the plugin.
Anki 2.1.49 has internally changed resulting in the following warning:
addons21/15061497/editor.py:234:'model' is deprecated: please use 'note_type'
This is likely the change of some member variable model
used in editor.py, in order to fix this all instances of .model
should be changed to .note_type
and then tested to make sure this does not change any behaviour
I want a feature that I can use cloze in function lines like :
{{c1:def}} = function(){
}
There is already "Markdown and KaTeX Support" addon, but yours is more convenient to me.
Can you make it?
Anki produces the following error when attempting to look at the fields of a card:
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeat until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site.
Debug info:
Anki 2.1.30 (06a69c25) Python 3.8.1 Qt 5.15.0 PyQt 5.15.0
Platform: Linux
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-08-18 11:23:49
Add-ons possibly involved: Auto Markdown - fix version
Caught exception:
Traceback (most recent call last):
File "aqt/models.py", line 168, in onFields
File "/home/nasfarley88/.local/share/Anki2/addons21/15061497/fields.py", line 18, in fieldDialog__init__
self.model = note.model()
AttributeError: 'dict' object has no attribute 'model'
I am trying to insert a table into the card, but it doesn't work. Does this plugin support markdown table syntax?
By the way, I used the following text to test the table syntax.
| Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |
Hi I get this error on Filds.. button
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.33 (3f403040) Python 3.8.1 Qt 5.15.0 PyQt 5.15.0
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-09-02 20:41:54
Add-ons possibly involved: ?Auto Markdown - fix version?
Caught exception:
Traceback (most recent call last):
File "aqt/webview.py", line 493, in handler
File "aqt/editor.py", line 481, in <lambda>
File "aqt/editor.py", line 352, in _onFields
File "/home/userx/.local/share/Anki2/addons21/15061497/fields.py", line 18, in fieldDialog__init__
self.model = note.model()
AttributeError: 'dict' object has no attribute 'model'
Anki 2.1.49 has brought up the following error:
JS error :1 Uncaught ReferenceError: onKey is not defined
This may interfere with the auto markdown capability, investigation needed.
Hi!
Just found your addon, and tried it in the purpose of helping me memorise sql and javascript. However, it does not seem to work currently. Whenever I press the Markdown-button, I get the following error:
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeat until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site.
Debug info:
Anki 2.1.41 (312fa278) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-04-03 21:19:27
Add-ons possibly involved: Auto Markdown - fix version
Caught exception:
Traceback (most recent call last):
File "aqt/webview.py", line 526, in handler
File "/Users/leocarlsson/Library/Application Support/Anki2/addons21/15061497/editor.py", line 137, in onHtmlAvailable
edited_field_html = re.sub(r'<img src="(.*?)".*?>', r'![An image](\1)', field_html)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 210, in sub
def subn(pattern, repl, string, count=0, flags=0):
TypeError: expected string or bytes-like object
This was working until the latest Anki update via Homebrew.
Here's the debug info:
Debug info:
Anki 2.1.50 (26d40c3a) Python 3.9.7 Qt 6.2.3 PyQt 6.2.3
Platform: Mac 12.2.1
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-04-15 10:48:09
Add-ons possibly involved: Auto Markdown - fix version
Caught exception:
Traceback (most recent call last):
File "aqt.webview", line 557, in handler
File "/Users/stephen/Library/Application Support/Anki2/addons21/15061497/editor.py", line 161, in onHtmlAvailable
edited_field_html = re.sub(
File "re", line 210, in sub
TypeError: expected string or bytes-like object
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.