Skip to content

Commit

Permalink
Refactor docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 25, 2023
1 parent 323908a commit b3985e2
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 84 deletions.
43 changes: 40 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,39 @@
* Configuration.
*
* @typedef UrlConfig
* Hosted Git info
* Hosted Git info.
*
* ###### Notes
*
* For this repository (`remarkjs/remark-validate-links` on GitHub)
* `urlConfig` looks as follows:
*
* ```js
* {
* // Domain of URLs:
* hostname: 'github.com',
* // Path prefix before files:
* prefix: '/remarkjs/remark-validate-links/blob/',
* // Prefix of headings:
* headingPrefix: '#',
* // Hash to top of markdown documents:
* topAnchor: '#readme',
* // Whether lines in files can be linked:
* lines: true
* }
* ```
*
* If this project were hosted on Bitbucket, it would be:
*
* ```js
* {
* hostname: 'bitbucket.org',
* prefix: '/remarkjs/remark-validate-links/src/',
* headingPrefix: '#markdown-header-',
* lines: false
* }
* ```
*
* @property {string | null | undefined} [headingPrefix]
* Prefix of headings (example: `'#'`, `'#markdown-header-'`).
* @property {string | null | undefined} [hostname]
Expand Down Expand Up @@ -132,8 +164,13 @@ const readmeExtensions = new Set(['.markdown', '.mdown', '.mkdn', '.md'])
const readmeBasename = /^readme$/i

/**
* Validate that Markdown links and images reference existing local files and
* headings.
* Check that markdown links and images point to existing local files and
* headings in a Git repo.
*
* > ⚠️ **Important**: The API in Node.js checks links to headings and files
* > but does not check whether headings in other files exist.
* > The API in browsers only checks links to headings in the same file.
* > The CLI can check everything.
*
* @param {Readonly<Options> | null | undefined} [options]
* Configuration (optional).
Expand Down
Loading

0 comments on commit b3985e2

Please sign in to comment.