Removemarkdown always leave a trailing `

When use removemarkdown() it always leave a trailing `

e.g.

json\n{\n "name": "Advent", \n "category": "letter", \n}\n

then use

{{ $json.body.content.removeMarkdown() }}

it shows

{
“name”:“Advent”,
“category”: “letter”
}
`

then have to use extra step to remove it.

Is it a bug?

n8 version: 2.1.4

Thanks,

Hi taulst,

Can’t say if it is a bug, but probably chaining a replace works for this?

eg {{ $json.body.content.removeMarkdown().replace(/`/g, ‘’).trim() }}

yes, use replace can work. but isn’t removemarkdown suppose to remove the tag directly? the ``` is a standard markdown code tag.

Hi @tauist, welcome!

I’m able to reproduce that, and you’re right there is an backtick ` left in the output,

This input triggers the issue:

```json
"name":"anan"
```

I think I figured out the reason, it seems to be caused by the newlines \n used after the ```

For comparison, this format works as expected:

```json "name":"anan"```

I suspect the issue is due to the regex in the function here:

However, if this is the intended behavior, you may need to format your inputs to match it..

Yes, currently I reformat it. It’s just that leaving a trailing ` doesn’t feel like intended.