Resolve an @include path relative to the including file's directory.
(ref: string, baseDir: string)
| 37 | |
| 38 | /** Resolve an @include path relative to the including file's directory. */ |
| 39 | function resolveInclude(ref: string, baseDir: string): string { |
| 40 | if (ref.startsWith("~/")) return path.join(os.homedir(), ref.slice(2)) |
| 41 | if (path.isAbsolute(ref)) return ref |
| 42 | return path.resolve(baseDir, ref) |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Extract `@path` references from leaf text (not inside code spans/blocks). |