mirror of
				https://github.com/theoludwig/markdownlint-rule-relative-links.git
				synced 2025-09-09 19:39:29 +02:00 
			
		
		
		
	feat: add support for markdownlint v0.38.0
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| import relativeLinksRule from "./src/index.js" | import relativeLinksRule, { markdownIt } from "./src/index.js" | ||||||
|  |  | ||||||
| const config = { | const config = { | ||||||
|   config: { |   config: { | ||||||
| @@ -10,6 +10,9 @@ const config = { | |||||||
|   globs: ["**/*.md"], |   globs: ["**/*.md"], | ||||||
|   ignores: ["**/node_modules", "**/test/fixtures/**"], |   ignores: ["**/node_modules", "**/test/fixtures/**"], | ||||||
|   customRules: [relativeLinksRule], |   customRules: [relativeLinksRule], | ||||||
|  |   markdownItFactory: () => { | ||||||
|  |     return markdownIt | ||||||
|  |   }, | ||||||
| } | } | ||||||
|  |  | ||||||
| export default config | export default config | ||||||
|   | |||||||
| @@ -83,7 +83,7 @@ We recommend configuring [markdownlint-cli2](https://github.com/DavidAnson/markd | |||||||
| `.markdownlint-cli2.mjs` | `.markdownlint-cli2.mjs` | ||||||
|  |  | ||||||
| ```js | ```js | ||||||
| import relativeLinksRule from "markdownlint-rule-relative-links" | import relativeLinksRule, { markdownIt } from "markdownlint-rule-relative-links" | ||||||
|  |  | ||||||
| const config = { | const config = { | ||||||
|   config: { |   config: { | ||||||
| @@ -93,6 +93,9 @@ const config = { | |||||||
|   globs: ["**/*.md"], |   globs: ["**/*.md"], | ||||||
|   ignores: ["**/node_modules"], |   ignores: ["**/node_modules"], | ||||||
|   customRules: [relativeLinksRule], |   customRules: [relativeLinksRule], | ||||||
|  |   markdownItFactory: () => { | ||||||
|  |     return markdownIt | ||||||
|  |   }, | ||||||
| } | } | ||||||
|  |  | ||||||
| export default config | export default config | ||||||
|   | |||||||
							
								
								
									
										2596
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2596
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										26
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								package.json
									
									
									
									
									
								
							| @@ -44,19 +44,19 @@ | |||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@types/markdown-it": "14.1.2", |     "@types/markdown-it": "14.1.2", | ||||||
|     "@types/node": "22.10.2", |     "@types/node": "22.15.17", | ||||||
|     "editorconfig-checker": "6.0.0", |     "editorconfig-checker": "6.0.1", | ||||||
|     "eslint": "9.17.0", |     "eslint": "9.26.0", | ||||||
|     "eslint-config-conventions": "18.0.0", |     "eslint-config-conventions": "19.2.0", | ||||||
|     "eslint-plugin-promise": "7.2.1", |     "eslint-plugin-promise": "7.2.1", | ||||||
|     "eslint-plugin-unicorn": "56.0.1", |     "eslint-plugin-unicorn": "59.0.1", | ||||||
|     "eslint-plugin-import-x": "4.6.1", |     "eslint-plugin-import-x": "4.11.1", | ||||||
|     "globals": "15.14.0", |     "globals": "16.1.0", | ||||||
|     "markdownlint": "0.37.2", |     "markdownlint": "0.38.0", | ||||||
|     "markdownlint-cli2": "0.17.0", |     "markdownlint-cli2": "0.18.0", | ||||||
|     "prettier": "3.4.2", |     "prettier": "3.5.3", | ||||||
|     "semantic-release": "24.2.0", |     "semantic-release": "24.2.3", | ||||||
|     "typescript-eslint": "8.18.2", |     "typescript-eslint": "8.32.0", | ||||||
|     "typescript": "5.7.2" |     "typescript": "5.8.3" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								src/index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								src/index.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,8 @@ | |||||||
|  | import type MarkdownIt from "markdown-it" | ||||||
| import type { Rule } from "markdownlint" | import type { Rule } from "markdownlint" | ||||||
|  |  | ||||||
| declare const relativeLinksRule: Rule | declare const relativeLinksRule: Rule | ||||||
|  |  | ||||||
| export default relativeLinksRule | export default relativeLinksRule | ||||||
|  |  | ||||||
|  | declare const markdownIt: MarkdownIt | ||||||
|  | export { markdownIt } | ||||||
|   | |||||||
| @@ -12,6 +12,8 @@ import { | |||||||
|   lineFragmentRe, |   lineFragmentRe, | ||||||
| } from "./utils.js" | } from "./utils.js" | ||||||
|  |  | ||||||
|  | export { markdownIt } from "./utils.js" | ||||||
|  |  | ||||||
| /** @typedef {import('markdownlint').Rule} MarkdownLintRule */ | /** @typedef {import('markdownlint').Rule} MarkdownLintRule */ | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import MarkdownIt from "markdown-it" | |||||||
|  |  | ||||||
| import { getHtmlAttributeRe } from "./markdownlint-rule-helpers/helpers.js" | import { getHtmlAttributeRe } from "./markdownlint-rule-helpers/helpers.js" | ||||||
|  |  | ||||||
| const markdownIt = new MarkdownIt({ html: true }) | export const markdownIt = new MarkdownIt({ html: true }) | ||||||
|  |  | ||||||
| export const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/ | export const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import assert from "node:assert/strict" | |||||||
|  |  | ||||||
| import * as markdownlint from "markdownlint/promise" | import * as markdownlint from "markdownlint/promise" | ||||||
|  |  | ||||||
| import relativeLinksRule from "../src/index.js" | import relativeLinksRule, { markdownIt } from "../src/index.js" | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * |  * | ||||||
| @@ -18,6 +18,9 @@ const validateMarkdownLint = async (fixtureFile) => { | |||||||
|       "relative-links": true, |       "relative-links": true, | ||||||
|     }, |     }, | ||||||
|     customRules: [relativeLinksRule], |     customRules: [relativeLinksRule], | ||||||
|  |     markdownItFactory: () => { | ||||||
|  |       return markdownIt | ||||||
|  |     }, | ||||||
|   }) |   }) | ||||||
|   return lintResults[fixtureFile] |   return lintResults[fixtureFile] | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user