@@ -67,6 +67,69 @@ describe("lintMemoryWikiVault", () => {
6767 expect ( result . issues . map ( ( issue ) => issue . code ) ) . not . toContain ( "broken-wikilink" ) ;
6868 } ) ;
6969
70+ it ( "does not report broken-wikilink for [[...]] inside fenced code blocks or inline code" , async ( ) => {
71+ const { rootDir, config } = await createVault ( {
72+ prefix : "memory-wiki-lint-fenced-code-" ,
73+ config : {
74+ vault : { renderMode : "obsidian" } ,
75+ } ,
76+ } ) ;
77+ await Promise . all (
78+ [ "entities" , "sources" ] . map ( ( dir ) => fs . mkdir ( path . join ( rootDir , dir ) , { recursive : true } ) ) ,
79+ ) ;
80+
81+ await fs . writeFile (
82+ path . join ( rootDir , "sources" , "code-snippets.md" ) ,
83+ renderWikiMarkdown ( {
84+ frontmatter : {
85+ pageType : "source" ,
86+ id : "source.code-snippets" ,
87+ title : "Code Snippets" ,
88+ } ,
89+ body : [
90+ "# Code Snippets" ,
91+ "" ,
92+ "Normal text with no wikilinks here." ,
93+ "" ,
94+ "```bash" ,
95+ 'if [[ "$name" == "Alice" ]]; then' ,
96+ " echo found" ,
97+ "fi" ,
98+ "```" ,
99+ "" ,
100+ "```scala" ,
101+ "val result = Future[Option[User]] {" ,
102+ ' collectionName = "users"' ,
103+ "}" ,
104+ "```" ,
105+ "" ,
106+ 'Inline code: `val userId: String` and `[[ "$str" == "test" ]]`.' ,
107+ ] . join ( "\n" ) ,
108+ } ) ,
109+ "utf8" ,
110+ ) ;
111+ await fs . writeFile (
112+ path . join ( rootDir , "entities" , "alpha.md" ) ,
113+ renderWikiMarkdown ( {
114+ frontmatter : {
115+ pageType : "entity" ,
116+ id : "entity.alpha" ,
117+ title : "Alpha" ,
118+ sourceIds : [ "source.code-snippets" ] ,
119+ } ,
120+ body : "# Alpha\n" ,
121+ } ) ,
122+ "utf8" ,
123+ ) ;
124+
125+ const result = await lintMemoryWikiVault ( config ) ;
126+
127+ const linkIssues = result . issues . filter (
128+ ( issue ) => issue . path === "sources/code-snippets.md" && issue . code === "broken-wikilink" ,
129+ ) ;
130+ expect ( linkIssues ) . toHaveLength ( 0 ) ;
131+ } ) ;
132+
70133 it ( "accepts unmanaged raw markdown source pages without page frontmatter" , async ( ) => {
71134 const { rootDir, config } = await createVault ( {
72135 prefix : "memory-wiki-lint-raw-sources-" ,
0 commit comments