Markdown Easy won't install if Markdown Text Filter already exists

Created on 27 December 2024, 3 months ago

Problem/Motivation

If a text filter "Markdown" is already present the module refuses to install with an error "the markdown text filter already exists". This is happening if you use the "Markdown" module and you would also like to add "Markdown Easy". Even deinstallling "Markdown" module doesn't allow to install "Markdown Easy" as the text filter is still there.
There is no option for completely deleting a text filter (just "disabling") which doesn't solve the problem.

Proposed resolution

If "Markdown" text filter is already present, don't throw error and enable the module.

Workaround

There is a workaround to circumvent this scenario: As stated in issue https://www.drupal.org/project/markdown_easy/issues/3436943 🐛 Markdown text format not created Closed: works as designed before 1.0.1 the text filter wasn't created upon enabling the module, so you can downgrade to 1.0.0 by running:

composer require 'drupal/markdown_easy:1.0.0'

afterwards enable the module, then upgrade again.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇹Austria roromedia Linz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @roromedia
  • Merge request !13created mr for markdown-easy → (Open) created by Unnamed author
  • Pipeline finished with Success
    3 months ago
    Total: 224s
    #379611
  • 🇧🇪Belgium BramDriesen Belgium 🇧🇪

    I have the feeling this MR will fundamentally break the module.

  • 🇺🇸United States ultimike Florida, USA

    I have to agree with @bramdriesen on all of his comments. I would like to see this MR cleaned up a bit and a test added before considering this change (especially because this is a bit of an edge case and a workaround exists.)

    -mike

  • 🇮🇪Ireland lostcarpark

    The change in the MR seems overcomplicated, and I'm not sure it fixes the problem that the module won't install if there's a Markdown filter already existing.

    Wouldn't a much simpler solution be to move config/install/filter.format.markdown.yml to config/optional/filter.format.markdown.yml?

    This would mean that if there's a existing Markdown filter, it would be left as-is, and it would be up to the site builder to apply Markdown Easy to it. I feel this is reasonable as we don't know what might be in an existing filter, so we shouldn't change it. I think expecting a manual reconfiguration of the text filter is reasonable.

  • Status changed to Needs review 22 days ago
  • 🇺🇸United States aasarava San Diego

    I agree with the solution proposed by @lostcarpark. It's much simpler and it works. If you're migrating from the markdown module or already have a markdown filter for any reason, you shouldn't get stuck trying to install markdown_easy.

  • 🇧🇪Belgium BramDriesen Belgium 🇧🇪

    Patch looks good, but easier for the maintainer if it's a MR.

Production build 0.71.5 2024