Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invisible/unprintable character appended to result #2266

Closed
paddotk opened this issue Nov 4, 2021 · 1 comment
Closed

Invisible/unprintable character appended to result #2266

paddotk opened this issue Nov 4, 2021 · 1 comment

Comments

@paddotk
Copy link

paddotk commented Nov 4, 2021

Marked version:
3.0.8

Describe the bug
Note: Not tried with 4.0.0 since I'm running into another blocking issue there, but since I can't find any issues or changelogs addressing this bug, I assume the issue hasn't been resolved yet.

When parsing a string with marked(), the returned string has an invisible character at the end. This makes some of my unit tests fail unless I .trim() it first.

To Reproduce
Steps to reproduce the behavior:
Use marked() on any string.
You can see there is an invisible character by checking the length of the output string:

const str = 'Hello there';
console.log(utils.parseMarkdown(str).length); // 19
console.log(utils.parseMarkdown(str).trim().length); // 18
console.log(utils.parseMarkdown(str)[18]); // 
@UziTech
Copy link
Member

UziTech commented Nov 4, 2021

yes marked renderers add a newline character (\n) at the end of the markdown. That is by design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants