cncws/markdown-it-codetabs

Label spaces cause break

Closed this issue · 1 comments

The plugin works amazing. One issue is when you add a space in a label name, it breaks in the output. It renders only one tab.

It might make sense to capture and render anything after :.

\[(\w*)(?::(\w.*))?\] Added a . period.

MD file

```js [g1:Hello Hi]
console.log("hello");
```

```py [g1:Python3]
print("hello")
```



```py [g2:Python2]
print("hello")
```
```js [g2:JavaScript]
console.log("hello");
```

```js
console.log("Hello");
```

Output

In the first two code blocks, you can see Python is working, but it renders Hello Hi as a standard code block, even though it's grouped.

Screen Shot 2021-01-04 at 2 33 33 PM

cncws commented

Thank you for comment.
It's definitely not proper that label names can't use space. But I don't want capture anything, it makes label name complex.
Instead, I updated the RE by /\[(\w*)(?::([\w ]*))?\]/ to capture or \w. Hope this little update can help you.