digitalocean / digitalocean/do-markdownit

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

Open
#115 6 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
103
Forks
28
PR merge metrics
No merged PRs in 30d

Description

## 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.