markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

Bug when rendering ![][]

Open anhydrous99 opened this issue 9 months ago • 1 comments

Description

The following line ![][] raises a TypeError exception.

import Markdown from 'markdown-to-jsx'

<Markdown>![][]</Markdown>

Looks like refImage has no fallback for when the reference doesn't exist while refLink does.

Stack Trace -

TypeError: Cannot read properties of undefined (reading 'B')
    at Object.h (http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:815:27)
    at http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:991:26
    at t (http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:1006:14)
    at t (http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:1000:21)
    at q (http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:539:15)
    at qt (http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:1009:14)
    at __WEBPACK_DEFAULT_EXPORT__ (http://localhost:3000/main.8352f82ca6938aad7a39.hot-update.js:1038:58)
    at renderWithHooks (http://localhost:3000/static/js/bundle.js:20018:22)
    at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:23304:17)
    at beginWork (http://localhost:3000/static/js/bundle.js:24600:20)

Steps to Reproduce

This can be reproduced in the paygroud.

  1. Open the official playgroud
  2. copy and paste the following code snippet. ![][]

Result - Screenshot 2023-10-26 at 1 48 27 PM

anhydrous99 avatar Oct 26 '23 18:10 anhydrous99

Here is my attempt at fixing this: #525.

anhydrous99 avatar Nov 01 '23 17:11 anhydrous99