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

strikethrough in unordered list crashes page #24

Closed
Djinnxie opened this issue Jul 25, 2023 · 6 comments
Closed

strikethrough in unordered list crashes page #24

Djinnxie opened this issue Jul 25, 2023 · 6 comments

Comments

@Djinnxie
Copy link

Djinnxie commented Jul 25, 2023

Steps to reproduce:

add a strikethrough to a bullet point

- foo
- bar
- ~~ baz ~~

error produced

page is unreachable, error message is displayed instead

TypeError: DokuWiki\Plugin\Commonmark\Extension\Renderer\Block\ListItemRenderer::startsTaskListItem(): Argument #1 ($node) must be of type League\CommonMark\Node\Node, null given, called in /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/Renderer/Block/ListItemRenderer.php on line 40

I'm using a few other plugins and havent checked if the error is reproducable on a clean install yet. I'll look into this further when i get a chance

@adrienbeau
Copy link
Contributor

I can reproduce the issue on a rather clean install of Dokuwiki and commonmark plugin.

@xrat
Copy link

xrat commented Jul 28, 2023

I cannot reproduce the issue on my 2 production wikis running commonmark plugin v2022-10-08 on DW v2022-07-31b on PHP 7.4.

@adrienbeau
Copy link
Contributor

Did you remove the spaces around baz in the example above in order for the strikethrough syntax to trigger?

In case this is a version issue, my environment is as follow:

  • Ubuntu 22.04
  • PHP 8.1.2-1ubuntu2.13
  • DokuWiki 2023-04-04a "Jack Jackrum"
  • Commonmark Plugin 2023-05-29

@xrat
Copy link

xrat commented Jul 28, 2023

I had not removed the spaces. Thanks for pointing this out.

So, with my Commonmark plugin v2022-10-08 on DW v2022-07-31b on top of PHP 7.4 the source

<!DOCTYPE markdown>
- foo
- bar
- ~~baz~~

falsely renders as

<ul>
<li class="level1"><div class="li"> foo</div>
</li>
<li class="level1"><div class="li"> bar</div>
</li>
<li class="level1"><div class="li"> </div>
</li>
</ul>

<p>
  <del>baz</del>
</p>

but no fatal error.

@Djinnxie
Copy link
Author

Djinnxie commented Jul 29, 2023

the problem can be mitigated by putting a backslash before the strikethrough.

- foo
- bar
- \~~ baz ~~

I'll try and find an easy way to automatically find and add a backslash on saving as a stopgap solution. right now, i'm doing it client side which is super not ideal but prevents accidental breakages

here's my log

im using i'm using dokuwiki 2023-04-04a php 8.2

2023-07-29 04:34:35TypeError: DokuWiki\Plugin\Commonmark\Extension\Renderer\Block\ListItemRenderer::startsTaskListItem(): Argument #1 ($node) must be of type League\CommonMark\Node\Node, null given, called in /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/Renderer/Block/ListItemRenderer.php on line 40/config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/Renderer/Block/ListItemRenderer.php(52)
    #0 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/Renderer/Block/ListItemRenderer.php(40): DokuWiki\Plugin\Commonmark\Extension\Renderer\Block\ListItemRenderer->startsTaskListItem()
    #1 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php(90): DokuWiki\Plugin\Commonmark\Extension\Renderer\Block\ListItemRenderer->render()
    #2 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php(76): Dokuwiki\Plugin\Commonmark\DWRenderer->renderNode()
    #3 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/Renderer/Block/ListBlockRenderer.php(47): Dokuwiki\Plugin\Commonmark\DWRenderer->renderNodes()
    #4 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php(90): DokuWiki\Plugin\Commonmark\Extension\Renderer\Block\ListBlockRenderer->render()
    #5 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php(76): Dokuwiki\Plugin\Commonmark\DWRenderer->renderNode()
    #6 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Extension/Renderer/Block/DocumentRenderer.php(36): Dokuwiki\Plugin\Commonmark\DWRenderer->renderNodes()
    #7 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/DWRenderer.php(90): DokuWiki\Plugin\Commonmark\Extension\Renderer\Block\DocumentRenderer->render()
    #8 /config/dokuwiki/lib/plugins/commonmark/src/Dokuwiki/Plugin/Commonmark/Commonmark.php(47): Dokuwiki\Plugin\Commonmark\DWRenderer->renderNode()
    #9 /config/dokuwiki/lib/plugins/commonmark/action.php(34): Dokuwiki\Plugin\Commonmark\Commonmark::RendtoDW()
    #10 /app/www/public/inc/Extension/EventHandler.php(80): action_plugin_commonmark->_commonmarkparse()
    #11 /app/www/public/inc/Extension/Event.php(74): dokuwiki\Extension\EventHandler->process_event()
    #12 /app/www/public/inc/Extension/Event.php(132): dokuwiki\Extension\Event->advise_before()
    #13 /app/www/public/inc/Extension/Event.php(199): dokuwiki\Extension\Event->trigger()
    #14 /app/www/public/inc/parserutils.php(233): dokuwiki\Extension\Event::createAndTrigger()
    #15 /app/www/public/inc/parserutils.php(198): p_get_instructions()
    #16 /app/www/public/inc/parserutils.php(525): p_cached_instructions()
    #17 /app/www/public/inc/parserutils.php(299): p_render_metadata()
    #18 /app/www/public/inc/common.php(266): p_get_metadata()
    #19 /app/www/public/doku.php(97): pageinfo()
    #20 {main}

@adrienbeau
Copy link
Contributor

This bug has been fixed by PR #22, which has been merged in the main branch of code, but is not yet in a released version of the plugin.

@Djinnxie Djinnxie closed this as completed Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants