Giter Club home page Giter Club logo

anki-auto-markdown's People

Contributors

corrit-gshiel avatar gregorrr avatar jansurft avatar natfarleydev avatar smart-town avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

anki-auto-markdown's Issues

Keep images when switching to Markdown

Currently, when an image is pasted into the editor and then the field is converted to markdown, the image disappears. E.g.

Before markdown:
image

After markdown:
image

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

'NoneType' object has no attribute 'strip' / TypeError: expected string or bytes-like object

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

Create CI for formatting and syntax

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.

code highlight for php does not work fine

when i write php code begin with ```php , it does not hightlight the php syntax.

the backgroud of the code block is dark. show as the pic below.

image

image

what i want is like this : (written in go)
image

image

addons21/15061497/editor.py:234:'model' is deprecated: please use 'note_type'

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

Can I use cloze?

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?

Fields.py has problems in 2.1.28+

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'

Table syntax support ?

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        |

AttributeError: 'dict' object has no attribute 'model'

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'

Error when pressing the markdown-button

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

Broken for Anki Version ⁨2.1.50 (26d40c3a)⁩

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.