Closed dhiren2 closed 1 year ago
Thank you.
transform_field
instead, so that handling a JS failure is explicit:
a. Add Optional
to the argument's type hint.
b. Add a guard clause that returns early.Re 1.: I just saw https://github.com/gregorias/anki-code-highlighter/issues/34#issuecomment-1402698972. No need to answer that.
This PR is made obsolete by https://github.com/gregorias/anki-code-highlighter/commit/f92ba2c21c39c4d1e496e4ba54da639b5a5e388e.
There are cases where surroundContents() will fail. In this case,
web_editor_html
will beNone
, and then the regular expression search will throw an exception:This minor patch makes it fail silently so you don't get the exception.