Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(turndown-plugin-gfm): incompatible with original turndown #9881

Closed
maxpatiiuk opened this issue Feb 8, 2024 · 2 comments
Closed

bug(turndown-plugin-gfm): incompatible with original turndown #9881

maxpatiiuk opened this issue Feb 8, 2024 · 2 comments
Labels
bug It's a bug stale An issue that hasn't been active for a while...

Comments

@maxpatiiuk
Copy link
Contributor

Operating system

macOS

Joplin version

n/a

Desktop version info

n/a, but if you really need, it, Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Current behaviour

This commit 832e945
adds a new function to turndown - 832e945#diff-582d99eae9ac2e71f31737a47dcffa472aa1932ce7a04a78608f11c368406bbbR150
then references the function here: 832e945#diff-0d19da1f333aad24ea14096ec7f96319837830a1b9398112215a9ec9d40d9b81R226
and finally here: 832e945#diff-0d19da1f333aad24ea14096ec7f96319837830a1b9398112215a9ec9d40d9b81R164

But, that function is not available if using @joplin/turndown-plugin-gfm, resulting in the following exception:

readerMode.bundle.js:50248 TypeError: isCodeBlock_ is not a function
    at nodeContains (readerMode.bundle.js:218:29)
    at tableShouldBeHtml (readerMode.bundle.js:247:10)
    at Object.filter (readerMode.bundle.js:127:42)
    at filterValue (readerMode.bundle.js:88022:16)
    at findRule (readerMode.bundle.js:88010:9)
    at Rules.forNode (readerMode.bundle.js:87995:17)
    at TurndownService.replacementForNode (readerMode.bundle.js:88528:25)
    at readerMode.bundle.js:88493:40
    at NodeList.reduce (<anonymous>)
    at TurndownService.process (readerMode.bundle.js:88486:17)

Expected behaviour

Proposed solutions:

  1. Document clearly that @joplin/turndown-plugin-gfm is not compatible with the original turndown and that @joplin/turndown should be used instead
  2. Maintain compatibility with turndown. In this case it is quite simple - replace the function call with conditional function call isCodeBlock_?.(child). Thougho there cases (if there are any) might not be as simple

Logs

No response

@maxpatiiuk maxpatiiuk added the bug It's a bug label Feb 8, 2024
maxpatiiuk added a commit to maxpatiiuk/text-hoarder that referenced this issue Feb 8, 2024
Workaround for mixmark-io/turndown-plugin-gfm#3
and other issues too ... by migrating to a more well-maintained fork of
Turndown.

Though the fork also has it's own issues. Applying workarounds for:
Workaround for laurent22/joplin#9885
Workaround for laurent22/joplin#9884
Workaround for laurent22/joplin#9881
Copy link
Contributor

github-actions bot commented Mar 9, 2024

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

@github-actions github-actions bot added the stale An issue that hasn't been active for a while... label Mar 9, 2024
Copy link
Contributor

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, feel free to create a new issue with up-to-date information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug stale An issue that hasn't been active for a while...
Projects
None yet
Development

No branches or pull requests

1 participant