forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#28491 from github/repo-sync
Repo sync
- Loading branch information
Showing
10 changed files
with
96 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import rules from '../../../../node_modules/markdownlint/lib/rules.js' | ||
import { gitHubDocsMarkdownlint } from '../linting-rules/index.js' | ||
import { baseConfig } from '../../style/base.js' | ||
import { githubDocsConfig, searchReplaceConfig } from '../../style/github-docs.js' | ||
import { customConfig } from '../../style/github-docs.js' | ||
|
||
export const customRules = gitHubDocsMarkdownlint.rules | ||
export const allRules = [...rules, ...gitHubDocsMarkdownlint.rules] | ||
export const allConfig = { ...baseConfig, ...githubDocsConfig, ...searchReplaceConfig } | ||
export const allConfig = { ...baseConfig, ...customConfig } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
src/content-linter/tests/unit/internal-link-punctuation.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { jest } from '@jest/globals' | ||
|
||
import { runRule } from '../../lib/init-test.js' | ||
import { linkPunctuation } from '../../lib/linting-rules/link-punctuation.js' | ||
|
||
jest.setTimeout(60 * 1000) | ||
|
||
describe(linkPunctuation.names.join(' - '), () => { | ||
test('inline links without quotes or a period should not error', async () => { | ||
const markdown = [ | ||
'[This should pass](./image.png)', | ||
'[AUTOTITLE](./image.png)', | ||
// These are not necessarily good descriptions, but they are valid | ||
// per the requirements of the rule | ||
"[A link with end quote'](./image.png)", | ||
'["A link with start quote](./image.png)', | ||
'[A link with a question mark?](./image.png)', | ||
'[A link with an exclamation point!](./image.png)', | ||
].join('\n') | ||
|
||
const result = await runRule(linkPunctuation, { strings: { markdown } }) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(0) | ||
}) | ||
test('inline links with quotes or punctuation should error', async () => { | ||
const markdown = [ | ||
'["A title"](./image.png)', | ||
"['A title'](./image.png)", | ||
'[A title.](./image.png)', | ||
'["A title."](./image.png)', | ||
'["A title".](./image.png)', | ||
"['A title.'](./image.png)", | ||
"['A title'.](./image.png)", | ||
"['A title'?](./image.png)", | ||
'["A title"!](./image.png)', | ||
"['A title?'](./image.png)", | ||
'["A title!"](./image.png)', | ||
].join('\n') | ||
|
||
const result = await runRule(linkPunctuation, { strings: { markdown } }) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(11) | ||
expect(errors[0].errorRange).toEqual([2, 9]) | ||
expect(errors[6].lineNumber).toBe(7) | ||
}) | ||
test('links that is not plain text', async () => { | ||
const markdown = [ | ||
'[*emphasize*](./image.png)', | ||
'[**boldness**](./image.png)', | ||
'[**boldness** and *emphasize*](./image.png)', | ||
].join('\n') | ||
|
||
const result = await runRule(linkPunctuation, { strings: { markdown } }) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(0) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters