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

Marking code inside a codeblock will add the closing mark tag in the wrong position #115

Open
dbadea-heits opened this issue Jun 4, 2024 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@dbadea-heits
Copy link
Contributor

dbadea-heits commented Jun 4, 2024

Information

  • Plugin version: v1.14.0
  • Markdown-It version: v14.1.0
  • Environment: Chrome 119.0.6045.159

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:

```ruby
<^><% %><^>
<% %>
```
```ruby
<^>to: ""<^>
```
```js
<^>const test = `hello<^>
world`;
```

In the last example we can see the mark closing tag is closed before the string literal starts:
Screenshot 2024-06-03 at 12 35 53

Steps to reproduce

Navigate to https://www.digitalocean.com/community/markdown
Clear the textbox
Paste one of the above examples inside of the textbox

Expected behavior

Text inside of the <^> marking token gets marked in the resulting code block

@GroophyLifefor

This comment was marked as off-topic.

@MattIPv4

This comment was marked as off-topic.

@GroophyLifefor

This comment was marked as off-topic.

@MattIPv4

This comment was marked as off-topic.

@GroophyLifefor

This comment was marked as off-topic.

@MattIPv4
Copy link
Contributor

MattIPv4 commented Aug 5, 2024

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)

@MattIPv4 MattIPv4 added bug Something isn't working help wanted Extra attention is needed labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants