Problem/Motivation

Auf der Website ist ein unvorhergesehener Fehler aufgetreten. Bitte versuchen Sie es später nochmal.

InvalidArgumentException: Cannot add two delimiter processors for char "~" and minimum length 2 in League\CommonMark\Delimiter\Processor\StaggeredDelimiterProcessor->add() (line 72 of /var/www/html/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php).
League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection->addStaggeredDelimiterProcessorForChar('~', Object, Object) (Line: 33)
League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection->add(Object) (Line: 155)
League\CommonMark\Environment->addDelimiterProcessor(Object) (Line: 21)
League\CommonMark\Extension\Strikethrough\StrikethroughExtension->register(Object) (Line: 270)
League\CommonMark\Environment->initializeExtensions() (Line: 349)
League\CommonMark\Environment->dispatch(Object) (Line: 65)
League\CommonMark\DocParser->parse('# Alles

Alles muss gut gemacht werden.') (Line: 64)
League\CommonMark\Converter->convertToHtml('# Alles

Alles muss gut gemacht werden.') (Line: 85)
Drupal\markdown\Plugin\Markdown\CommonMark\CommonMark->convertToHtml('# Alles

Alles muss gut gemacht werden.', Object) (Line: 187)
Drupal\markdown\Plugin\Markdown\BaseParser->parse('# Alles

Alles muss gut gemacht werden.', Object) (Line: 148)
Drupal\markdown\Plugin\Filter\FilterMarkdown->process('# Alles

Alles muss gut gemacht werden.', 'de') (Line: 118)
Drupal\filter\Element\ProcessedText::preRenderText(Array)
call_user_func_array(Array, Array) (Line: 100)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725', 'silenced_deprecation', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 781)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 166)
__TwigTemplate_e0259a3e21f94f3cc68f2d23e70a687ed464d31b571c22d4883416cea83fbac6->getrender_item(Array, Array, 1) (Line: 85)
__TwigTemplate_e0259a3e21f94f3cc68f2d23e70a687ed464d31b571c22d4883416cea83fbac6->doDisplay(Array, Array) (Line: 453)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 420)
Twig\Template->display(Array, Array) (Line: 39)
__TwigTemplate_44f5f0905ed6bb1990f4284b00025b1fb6795d9514999682ca6df8a99ac0a573->doDisplay(Array, Array) (Line: 453)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 420)
Twig\Template->display(Array, Array) (Line: 36)
__TwigTemplate_ee513463b9ef221974970c0c67b74816fdb18dc241672d275a8f46abad3d1724->doDisplay(Array, Array) (Line: 453)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 420)
Twig\Template->display(Array) (Line: 432)
Twig\Template->render(Array) (Line: 64)
twig_render_template('themes/contrib/bulma/templates/field/field--text-long.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('field', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 96)
__TwigTemplate_22c9390cfeff0aa0419bd072949b173f1939ef4a06ec98e609a8a903a2e0ae9e->doDisplay(Array, Array) (Line: 453)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 420)
Twig\Template->display(Array) (Line: 432)
Twig\Template->render(Array) (Line: 64)
twig_render_template('themes/contrib/bulma/templates/node/node.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

View a simple text with this setting.

$ cat config-sync/filter.format.cst_markdown.yml
uuid: 29e09b44-c86e-4270-9b63-06129fae867f
langcode: de
status: true
dependencies:
  module:
    - markdown
name: 'Markdown (Consent)'
format: cst_markdown
weight: 0
filters:
  markdown:
    id: markdown
    provider: markdown
    status: true
    weight: -15
    settings:
      parser:
        id: league/commonmark-gfm
        render_strategy:
          type: filter_output
          allowed_html: '<a href hreflang> <abbr> <blockquote cite> <br> <cite> <code> <div> <em> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <img alt height src width> <li> <ol start type=''1 A I''> <p> <pre> <span> <strong> <ul type>'
          plugins:
            - league/commonmark-ext-heading-permalink
            - league/commonmark-ext-strikethrough
            - league/commonmark-ext-table
            - league/commonmark-ext-task-list
            - markdown
        settings:
          allow_unsafe_links: true
          enable_em: true
          enable_strong: true
          html_input: allow
          max_nesting_level: 0
          renderer:
            block_separator: \n
            inner_separator: \n
            soft_break: \n
          unordered_list_markers:
            - '-'
            - '*'
            - +
          use_asterisk: true
          use_underscore: true
        extensions:
          -
            id: league/commonmark-ext-autolink
            enabled: true
            settings: {  }
          -
            id: league/commonmark-ext-heading-permalink
            enabled: true
            settings:
              html_class: heading-permalink
              id_prefix: user-content
              inner_contents: '<svg class="heading-permalink-icon" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>'
              insert: before
              title: Permalink
          -
            id: league/commonmark-ext-strikethrough
            enabled: true
          -
            id: league/commonmark-ext-table
            enabled: true
          -
            id: league/commonmark-ext-task-list
            enabled: true
          -
            id: league/commonmark-ext-toc
            enabled: true
            settings:
              html_class: table-of-contents
              max_heading_level: 6
              min_heading_level: 1
              normalize: relative
              placeholder: '[TOC]'
              position: placeholder
              style: bullet
    filterFormat: cst_markdown
  filter_html:
    id: filter_html
    provider: filter
    status: false
    weight: -10
    settings:
      allowed_html: '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>'
      filter_html_help: true
      filter_html_nofollow: false

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork markdown-3187009

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

geek-merlin created an issue. See original summary.

geek-merlin’s picture

Status: Active » Closed (outdated)
Related issues: +#3187011: [markdown] Release 8.x-2.0

It looks like RC1 is quite outdated.

geek-merlin’s picture

FWIW, i could not disable extensions via the UI, but removing strikethrough via config-fu worked for now.

geek-merlin’s picture

Title: Throws exception » RC1 throws "Cannot add two delimiter processors for char "~" "
markhalliwell’s picture

Again, this sounds like an issue with the installation of the league/commonmark library via Composer. Perhaps the download was corrupted? Might try removing your Composer cache and trying to require the latest version again (1.5.7).

geek-merlin’s picture

Status: Closed (outdated) » Active

Again i got stuck on this.

As noted in #3198622: WSOD "Class DisallowedRawHTMLExtension does not exist", i have 2 servers that behave differently with this. While the dev server seemed to ignore wrongly cased class name, the live server ignored case on class_exists, but not on ReflectionClass(). (php7.2.17 vs 7.2.34, composer1 vs 2)

Now, on the dev server MD "works", but all extensions are reported as "not installed" (remember, i proposed a "bandaid" patch for this, that did not address the underlying problem), but on the live server the situation is this:
- if i create a filter format and "Inherit site-wide settings", everything "works".
- if i create a filter format and "override site-wide settings" (with exactly same settings), i get this error. (maybe the override is applied in addition to site-wide?)

geek-merlin’s picture

markhalliwell’s picture

It could be that the config is outdated as something is referencing the old plugin name league/commonmark-ext-strikethrough vs the new plugin name: commonmark-strikethrough.

There was a post update that was created to help and attempt to resolve this; however you may need to just recreate your text format from scratch.

It could also be, potentially, that the parser was the default commonmark (with the extensions manually enabled) and then was changed to commonmark-gfm which wouldn't normally have those enabled, technically, since they're supposed to be bundled. So it could be that it's attempting to add the extensions, after the commonmark-gfm already did.

Try manually removing the extensions from the config, reimport it and see if that resolves it.

My guess is that we'll need to fix ExtensionCollection to account for this also exclude bundled extensions.

markhalliwell’s picture

Title: RC1 throws "Cannot add two delimiter processors for char "~" " » Bundled extensions are registered twice
geek-merlin’s picture

Thanks a bunch for the pointers, i'll work through this soon.
(And cool you found time to code on on this ! ;-)

markhalliwell’s picture

Status: Active » Needs review

Ok, this should fix it. I was able to reproduce the issue locally (got the same exception) and with this fix it now works as expected.

  • markhalliwell committed b856230 on 8.x-2.x
    Issue #3187009 by markhalliwell: Bundled extensions are registered twice
    
markhalliwell’s picture

Status: Needs review » Fixed
geek-merlin’s picture

💪👏!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.