Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.

Commit 9737156

Browse files
feat: add .mdx file support
v0.6.3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d940a98 commit 9737156

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dynamik-dev/refdocs",
3-
"version": "0.6.2",
3+
"version": "0.6.3",
44
"type": "module",
55
"description": "Local CLI tool that indexes markdown documentation and exposes fast fuzzy search with intelligent chunking",
66
"main": "dist/index.js",

src/indexer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function findMarkdownFiles(dirs: string[], baseDir: string): string[] {
1717
const stat = statSync(fullPath);
1818
if (stat.isDirectory()) {
1919
walk(fullPath);
20-
} else if (entry.endsWith(".md") || entry.endsWith(".txt")) {
20+
} else if (entry.endsWith(".md") || entry.endsWith(".mdx") || entry.endsWith(".txt")) {
2121
files.push(relative(baseDir, fullPath));
2222
}
2323
}

tests/indexer.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,21 @@ describe("findMarkdownFiles", () => {
4242
expect(files).toContain("docs/sub/nested.md");
4343
});
4444

45-
it("ignores non-md/txt files but includes .txt", () => {
45+
it("ignores non-md/mdx/txt files but includes .txt", () => {
4646
writeFileSync(join(tmpDir, "docs", "readme.md"), "# Hello");
4747
writeFileSync(join(tmpDir, "docs", "notes.txt"), "not markdown");
4848
writeFileSync(join(tmpDir, "docs", "data.json"), "{}");
4949
const files = findMarkdownFiles(["docs"], tmpDir);
5050
expect(files).toEqual(["docs/notes.txt", "docs/readme.md"]);
5151
});
5252

53+
it("finds .mdx files", () => {
54+
writeFileSync(join(tmpDir, "docs", "readme.md"), "# Hello");
55+
writeFileSync(join(tmpDir, "docs", "component.mdx"), "# Component\n\nSome MDX content.");
56+
const files = findMarkdownFiles(["docs"], tmpDir);
57+
expect(files).toEqual(["docs/component.mdx", "docs/readme.md"]);
58+
});
59+
5360
it("returns empty array for missing directory", () => {
5461
const files = findMarkdownFiles(["nonexistent"], tmpDir);
5562
expect(files).toEqual([]);

0 commit comments

Comments
 (0)