chatgpt-plugin/utils/text.js
2022-12-10 19:45:54 +08:00

9 lines
182 B
JavaScript

/**
* 判断一段markdown文档中是否包含代码
* @param text
*/
export function codeExists (text = '') {
let regex = /^[\s\S]*\$.*\$[\s\S]*/
return regex.test(text)
}