Parse a single line of text in a .md file. * @returns new content in 3 parts if custom id is needed, null otherwise.
(line: string)
| 89 | * @returns new content in 3 parts if custom id is needed, null otherwise. |
| 90 | */ |
| 91 | function getCustomId(line: string): [hash: string, headerContent: string, customId: string] | null { |
| 92 | const m = line.trim().match(headerTest); |
| 93 | if (!m) { |
| 94 | return null; |
| 95 | } |
| 96 | const m1 = m.groups!.headerContent.match(apiTest); |
| 97 | if (!m1) { |
| 98 | return null; |
| 99 | } |
| 100 | const customId = m1.groups!.code.toLowerCase(); |
| 101 | return [m[1], m[2], `{#${customId}}`]; |
| 102 | } |
| 103 | |
| 104 | /** Process a md file. Rewrites the file content if custom ids are needed. */ |
| 105 | async function processFile(path: string): Promise<void> { |
no outgoing calls
searching dependent graphs…