Open dbadea-heits opened 5 months ago
Hi @dbadea-heits ,
I was interested and did a little experiment, I added your case to the existing test cases and I was curious about the result because I was trying to catch the source of the problem.
New test case:
it("handles hightlight tags in code block with newline", () => {
expect(md.render("```js\n<^>const test = `hello<^>\nworld`;\n```")).toBe(
'<pre><code class="language-js"><mark>const test = `hello</mark>\nworld`;\n</code></pre>\n'
);
});
as we see mark includes 'hello' part so code should be working, and you'd be surprised what you see test case passed 😄
also I looked the process for be sure and process too says It's okay. (everything is fine in the image below)
I couldn't find any proof because prism is a bit complicated, but I think the problem is that prism manipulates the code afterwards, it manipulates the code to make that string yellow when everything is fine.
As a result, I could not solve the problem, sorry, there seems to be a conflict for a different reason
@GroophyLifefor I don't think your test-case here is valid. Your expected result does not include any actual syntax highlighting from Prism.
@MattIPv4 Hi Matt, Thank you for the information, I couldn't try it at the prism stage, so I was in between a lot, but when I couldn't find a problem in highlight, I thought it was a possibility.
This bug specifically relates to the interaction between Prism syntax highlighting, and the highlight markup 👍
This bug specifically relates to the interaction between Prism syntax highlighting, and the highlight markup 👍
Yeah It's what I said in first comment, and if we talk about test-case, prism is an after-effect as far as I understand, so I couldn't test it or find out how to test it.
There are a whole set of dedicated test cases for it: https://github.com/digitalocean/do-markdownit/blob/master/modifiers/prismjs.test.js (specifically the HTML preservation
block of tests)
Information
Details
Description
Attempting to mark code inside of a code block will misplace the mark closing tag, placing it before the next token starts, and if it is added after the last token ends it needs a whitespace to get added, other wise it is included in the last token. Usually the string-literal token is the easiest to reproduce this with.
Examples: