Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
fix(rdmd/codetabs): closes #719
Browse files Browse the repository at this point in the history
  • Loading branch information
rafegoldberg committed Jun 3, 2020
1 parent 7aa3958 commit 58dc35a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/markdown/processor/parse/flavored/code-tabs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const RGXP = /^(```([^]*?)```)(?=\n(?!```)|```\n\n|$)/g;
const RGXP = /^(```([^]*?)```)(?=\n(?!```|\w)|```\n\n|$)/g;

function tokenizer(eat, value) {
const [match] = RGXP.exec(value) || [];
Expand All @@ -16,12 +16,12 @@ function tokenizer(eat, value) {
* For each of our adjacent code blocks we'll:
* 1) normalize any unbalanced tilde wrappers
* 2) split the matching block in to three parts:
* - syntax [lang] extension
* - [lang] syntax extension
* - [meta] tab name (optional)
* - the [code] snippet text
* - [code] snippet text
*/
// eslint-disable-next-line no-param-reassign
val = ['```', val.replace('```', ''), '```'].join('');
val = ['```', val.replace('```', ''), '```'].join('').trim();

// eslint-disable-next-line unicorn/no-unsafe-regex
const [, lang, meta = null, code = ''] = /```([^\s]+)?(?: *([^\n]+))?\s?([^]+)```/gm.exec(val);
Expand All @@ -42,7 +42,7 @@ function tokenizer(eat, value) {
// return a single code block
if (kids.length === 1) return eat(match)(kids[0]);

// return the tabbed code block editor
// return a tabbed code block
return eat(match)({
type: 'code-tabs',
className: 'tabs',
Expand Down

0 comments on commit 58dc35a

Please sign in to comment.