mirror of
				https://github.com/theoludwig/markdownlint-rule-relative-links.git
				synced 2025-09-09 19:39:29 +02:00 
			
		
		
		
	fix: empty id fragment should be invalid
This commit is contained in:
		
							
								
								
									
										15
									
								
								src/index.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/index.js
									
									
									
									
									
								
							| @@ -63,7 +63,20 @@ const customRule = { | ||||
|               continue | ||||
|             } | ||||
|  | ||||
|             if (type === "link_open" && url.hash !== "") { | ||||
|             if (type !== "link_open") { | ||||
|               continue | ||||
|             } | ||||
|  | ||||
|             if (url.hash.length <= 0) { | ||||
|               if (hrefSrc.includes("#")) { | ||||
|                 onError({ | ||||
|                   lineNumber, | ||||
|                   detail: `${detail} should have a valid fragment identifier`, | ||||
|                 }) | ||||
|               } | ||||
|             } | ||||
|  | ||||
|             if (url.hash.length > 0) { | ||||
|               const fileContent = fs.readFileSync(url, { encoding: "utf8" }) | ||||
|               const headings = getMarkdownHeadings(fileContent) | ||||
|               const anchorHTMLFragments = | ||||
|   | ||||
| @@ -119,7 +119,7 @@ const getMarkdownIdOrAnchorNameFragments = (content) => { | ||||
|     } | ||||
|  | ||||
|     const anchorIdOrName = anchorMatch[1] | ||||
|     if (anchorMatch[1] === undefined) { | ||||
|     if (anchorIdOrName === undefined) { | ||||
|       continue | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user