UNPKG
extract-codefence
Version:
latest (0.0.4)
0.0.4
0.0.3
0.0.2
0.0.1
A utility to extract code from codefence blocks
extract-codefence
/
dist
/
index.js
9 lines
(8 loc)
•
183 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
// index.ts
var
extractCodefence = (text) => {
const
codefence = text.match(/
``
`(tsx?|typescript)?([\s\S]*?)`
``
/);
return
codefence?.[
2
].trim(); }; export { extractCodefence };