@dcrays/dcgchat-test 0.3.24 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/searchFile.ts +5 -0
package/package.json
CHANGED
package/src/utils/searchFile.ts
CHANGED
|
@@ -101,6 +101,8 @@ const RX_EXTRACT = {
|
|
|
101
101
|
inline: new RegExp(`mobook下的\\s*(${FILE_NAME_CLASS}\\.${EXT_ALT})`, 'gi'),
|
|
102
102
|
bold: new RegExp(`\\*\\*(${FILE_NAME_CLASS}\\.${EXT_ALT})\\*\\*`, 'gi'),
|
|
103
103
|
loose: new RegExp(`(${FILE_NAME_CLASS}\\.${EXT_ALT})\\s*\\(`, 'gi'),
|
|
104
|
+
/** Markdown 列表:`- 文件名.ext` — 用 matchAll 取捕获组 1,避免 FILE_NAME 含 `-`/空格 时误把「- 」并入文件名 */
|
|
105
|
+
markdownList: new RegExp(`[-*•]\\s+(${FILE_NAME_CLASS}\\.${EXT_ALT})`, 'gi'),
|
|
104
106
|
inlineFile: new RegExp(`${FILE_NAME_CLASS}\\.${EXT_ALT}`, 'i')
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -203,6 +205,9 @@ export function extractMobookFiles(text = '') {
|
|
|
203
205
|
;(text.match(RX_EXTRACT.loose) || []).forEach((item) => {
|
|
204
206
|
addMobookMentionedFile(result, item.replace(/\s*\(.+$/, '').trim())
|
|
205
207
|
})
|
|
208
|
+
for (const m of text.matchAll(RX_EXTRACT.markdownList)) {
|
|
209
|
+
if (m[1]) addMobookMentionedFile(result, m[1].trim())
|
|
210
|
+
}
|
|
206
211
|
collectMobookPathsByScan(text, result)
|
|
207
212
|
} catch (e) {
|
|
208
213
|
dcgLogger(`extractMobookFiles error:${e}`)
|