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

Changed to destructure match in mdx-utils. Better support for browsers and builders. #369

Merged
merged 1 commit into from Apr 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions packages/mdx-utils/index.js
Expand Up @@ -14,15 +14,12 @@ exports.preToCodeBlock = preProps => {
...props
} = preProps.children.props;

const matches = className.match(/language-(?<lang>.*)/);
const [, match] = className.match(/language-([\0-\uFFFF]*)/);

return {
codeString: codeString.trim(),
className,
language:
matches && matches.groups && matches.groups.lang
? matches.groups.lang
: "",
language: match ? match : "",
...props
};
}
Expand Down