Links in readme.md break when imported to project page

Created on 21 August 2024, 3 months ago
Updated 22 August 2024, 3 months ago

Problem/Motivation

When importing the readme.md for a project into the project page, any links in the markdown get broken. They become links that point to nowhere in on the project page.

markdown
[Mermaid Diagram Field](https://www.drupal.org/project/mermaid_diagram_field)
becomes
<a rel="nofollow">Mermaid Diagram Field</a>
It has no href property so links to nothing.

Steps to reproduce

  1. Create a link in markdown in readme.md
  2. Go to the project page
  3. edit the page and click the button to import the markdown file.
  4. Save the changes
  5. View the link, notice it is a link to nowhere. There is no href property.

Example: readme.md https://git.drupalcode.org/project/content_model_documentation/-/blob/1....
Resulting project page: https://www.drupal.org/project/content_model_documentation β†’

Proposed resolution

It makes sense to me that if they were relative links, would be problematic and it might make sense to disable them, however, absolute URLs should be preserved.

  • Links with an absolute URL should be converted to working links
    [Mermaid Diagram Field](https://www.drupal.org/project/mermaid_diagram_field)
    becomes
    <a rel="nofollow" href="https://www.drupal.org/project/mermaid_diagram_field">Mermaid Diagram Field</a>
  • Links with a relative path, are often used to point to a drupal site path. Ideally these should be deconstructed to informative text
    [Configuration page](/admin/config-ui-path)
    becomes
    Configuration page (/admin/config-ui-path)

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: cannot reproduce

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States swirt Florida

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

Comments & Activities

  • Issue created by @swirt
  • πŸ‡ΊπŸ‡ΈUnited States drumm NY, US

    https://git.drupalcode.org/project/drupalorg/-/blob/7.x-3.x/drupalorg/dr... is the relevant code getting the rendered Markdown from GitLab and doing some post-processing.

    If I edit the project and import again, it looks like the example link <a href="https://www.drupal.org/project/mermaid_diagram_field">Mermaid Diagram Field</a> is coming through correctly now. I did not save the project page, just used the preview to check. Nothing has changed in that code or infrastructure, so I'm not sure what fixed this, if it is fixed.

  • Status changed to Closed: cannot reproduce 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    Thank you Drumm for looking into this. I just imported it again and you are right, it is fixed. I am not sure what changed, but I know this was failing on multiple projects of mine for quite a length of time. So much so that on some of them, I stopped putting links in the readme. I am glad this is working now. I'll count the mystery as a win. :)

    Changing this to closed (works as intended)

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    It might have been an unintended side effect of this line break handling from a month ago.
    https://git.drupalcode.org/project/drupalorg/-/commit/0331f4426c5cf44708...

Production build 0.71.5 2024