mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
7a01793062
* Revert "Revert "markdown format"" * fix formating * fix readme * add .markdownlint.json * add markdownlint-rules-grav-pages * add markdownlint-rules-grav-pages files * add license for Markdown Lint Rules for Grav Pages * fix [figure] mess * fix [figure] mess 2 * fix [figure] mess 3 * maj .gitignore * various fixes * fix markdownlint-rules-grav-pages * second formater pass * various manual fixes * add .markdownlintignore * markdownlintignore: auto-generated pages * disable proper-names for html_elements * another bunch of various markdown fixes * Update pages/02.administer/10.install/20.dns_config/dns_config.es.md Co-authored-by: tituspijean <titus+yunohost@pijean.ovh> --------- Co-authored-by: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Co-authored-by: tituspijean <titus+yunohost@pijean.ovh>
89 lines
3.5 KiB
JavaScript
89 lines
3.5 KiB
JavaScript
const markdownlint = require('markdownlint');
|
|
const validInternalLinks = require('../rules/valid-internal-links');
|
|
|
|
test('validate internal link', () => {
|
|
const src = `${__dirname}/assets/valid-internal-links/test.md`;
|
|
const results = markdownlint.sync({
|
|
customRules: validInternalLinks,
|
|
files: [src],
|
|
config: {
|
|
default: true,
|
|
'no-trailing-punctuation': {
|
|
punctuation: '.,;:!',
|
|
},
|
|
},
|
|
});
|
|
|
|
expect(results[src]).toEqual([
|
|
{
|
|
errorContext: '[LinkWithoutSrc]()',
|
|
errorDetail: null,
|
|
errorRange: [1, 18],
|
|
lineNumber: 46,
|
|
ruleDescription: 'No empty links',
|
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.25.1/doc/Rules.md#md042',
|
|
ruleNames: [
|
|
'MD042',
|
|
'no-empty-links',
|
|
],
|
|
},
|
|
{
|
|
lineNumber: 13,
|
|
ruleNames: ['valid-internal-links'],
|
|
ruleDescription: 'Rule that reports if a file has an internal link to an invalid file',
|
|
ruleInformation: null,
|
|
errorDetail: 'Relative link \'test.invalid\' does not link to a valid file.',
|
|
errorContext: '[Text](test.invalid)',
|
|
errorRange: null,
|
|
},
|
|
{
|
|
lineNumber: 17,
|
|
ruleNames: ['valid-internal-links'],
|
|
ruleDescription: 'Rule that reports if a file has an internal link to an invalid file',
|
|
ruleInformation: null,
|
|
errorDetail: 'Relative link \'../valid-images/invalid.md\' does not link to a valid file.',
|
|
errorContext: '[Text](../valid-images/invalid.md)',
|
|
errorRange: null,
|
|
},
|
|
{
|
|
lineNumber: 21,
|
|
ruleNames: ['valid-internal-links'],
|
|
ruleDescription: 'Rule that reports if a file has an internal link to an invalid file',
|
|
ruleInformation: null,
|
|
errorDetail: 'Relative link \'../valid-images\' does not link to a valid file.',
|
|
errorContext: '[Text](../valid-images)',
|
|
errorRange: null,
|
|
},
|
|
{
|
|
lineNumber: 23,
|
|
ruleNames: ['valid-internal-links'],
|
|
ruleDescription: 'Rule that reports if a file has an internal link to an invalid file',
|
|
ruleInformation: null,
|
|
errorDetail: 'Relative link \'test.invalid\' does not link to a valid file.',
|
|
errorContext: 'As child: valid [Text](test.md) invalid [Text](test.invalid)',
|
|
errorRange: null,
|
|
},
|
|
{
|
|
errorContext: '[Anchor](#invalid-anchor)',
|
|
errorDetail: "Did not find matching heading for anchor '#invalid-anchor'",
|
|
errorRange: null,
|
|
lineNumber: 26,
|
|
ruleDescription: 'Rule that reports if a file has an internal link to an invalid file',
|
|
ruleInformation: null,
|
|
ruleNames: [
|
|
'valid-internal-links',
|
|
],
|
|
},
|
|
{
|
|
errorContext: '[Text](../valid-images/test.md#invalid-external-anchor)',
|
|
errorDetail: "Did not find matching heading for anchor '#invalid-external-anchor'",
|
|
errorRange: null,
|
|
lineNumber: 36,
|
|
ruleDescription: 'Rule that reports if a file has an internal link to an invalid file',
|
|
ruleInformation: null,
|
|
ruleNames: [
|
|
'valid-internal-links',
|
|
],
|
|
},
|
|
]);
|
|
});
|