Skip to content

[BUG]: Markdown provided in types[key].link is injected as-is into HTMLAnchorElement's href attributeΒ #520

Description

@terrymun

πŸ“ Describe the bug

When using the recommended setup when defining custom types, the following configuration:

"types": {
  "core": {
    "symbol": "🏡️",
    "description": "Core team",
    "link": "[<%= symbol %>](https://github.com/bl-portal-bot)"
  }
}

...ends up generating the following cell:

<td align="center" valign="top" width="14.28%">
  <a href="https://github.com/terrymun">
    <img src="https://avatars.githubusercontent.com/u/5593067?v=4?s=96" width="96px;" alt="Terry Mun-Andersen"/>
    <br />
    <sub><b>Terry Mun-Andersen</b></sub>
  </a>
  <br />
  <!-- NOTE: This is where the problem is, see `href` value below -->
  <a href="[🏡️](https://github.com/orgs/LEGO/teams/bricklink-portal)" title="Core team">
    🏡️
  </a>
  <a href="https://github.com/lego/bl-portal-frontend/commits?author=terrymun" title="Code">πŸ’»</a></td>

...which is incorrect, as the markdown is injected as-is into the href attribute of the HTMLAnchorElement. Updating the link field to just contain the URL will then generate the correct output:

"types": {
  "core": {
  "symbol": "🏡️",
    "description": "Core team",
    "link": "https://github.com/bl-portal-bot"
  }
}
<td align="center" valign="top" width="14.28%">
  <a href="https://github.com/terrymun">
    <img src="https://avatars.githubusercontent.com/u/5593067?v=4?s=96" width="96px;" alt="Terry Mun-Andersen"/>
     <br />
     <sub><b>Terry Mun-Andersen</b></sub>
  </a>
  <br />
  <!-- NOTE: Here the `href` value is correct -->
  <a href="https://github.com/orgs/LEGO/teams/bricklink-portal" title="Core team">
    🏡️
  </a>
  <a href="https://github.com/lego/bl-portal-frontend/commits?author=terrymun" title="Code">πŸ’»</a>
</td>

πŸ‘£ Steps to Reproduce

Use the following configuration to add a custom emoji key as described in the docs:

"types": {
  "core": {
  "symbol": "🏡️",
    "description": "Core team",
    "link": "[<%= symbol %>](https://github.com/bl-portal-bot)"
  }
}

This results in the markdown string being inserted as-is into the href attribute.

🎯 Expected behavior

Using "link": "[<%= symbol %>](https://github.com/bl-portal-bot)" should generate the entire HTMLAnchorElement correctly.

πŸ’‘ Additional context

No response

🀝 Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions