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>
60 lines
2.1 KiB
JavaScript
60 lines
2.1 KiB
JavaScript
const markdownlint = require('markdownlint');
|
|
const validMetadataBlockRule = require('../rules/valid-metadata-block');
|
|
|
|
// TODO add more test cases
|
|
|
|
test('validate valid minimum block', () => {
|
|
const src = `${__dirname}/assets/valid-metadata-block/valid-minimum-block.md`;
|
|
const results = markdownlint.sync({
|
|
customRules: validMetadataBlockRule,
|
|
files: [src],
|
|
});
|
|
|
|
expect(results[src]).toEqual([]);
|
|
});
|
|
|
|
test('validate too long title', () => {
|
|
const src = `${__dirname}/assets/valid-metadata-block/invalid-too-long-title.md`;
|
|
const results = markdownlint.sync({
|
|
customRules: validMetadataBlockRule,
|
|
files: [src],
|
|
});
|
|
|
|
expect(results[src]).toEqual([{
|
|
errorContext: 'title: VeryLongTitleVeryLongTitleVeryLongTitleVeryLongTitleVeryLongTitleVeryLongTitleVeryLongTitleVeryLongTitleVeryLongTitle',
|
|
errorDetail: 'instance.title does not meet maximum length of 80',
|
|
errorRange: null,
|
|
lineNumber: 5,
|
|
ruleDescription: 'Rule that reports if a file does not have a valid grav metadata block',
|
|
ruleInformation: null,
|
|
ruleNames: ['valid-metadata-block'],
|
|
}]);
|
|
});
|
|
|
|
test('validate unrecognized property', () => {
|
|
const src = `${__dirname}/assets/valid-metadata-block/invalid-unrecognized-property.md`;
|
|
const results = markdownlint.sync({
|
|
customRules: validMetadataBlockRule,
|
|
files: [src],
|
|
});
|
|
|
|
expect(results[src]).toEqual([{
|
|
errorContext: 'title: My Page\ninvalid: field',
|
|
errorDetail: 'instance additionalProperty "invalid" exists in instance when not allowed',
|
|
errorRange: null,
|
|
lineNumber: 6,
|
|
ruleDescription: 'Rule that reports if a file does not have a valid grav metadata block',
|
|
ruleInformation: null,
|
|
ruleNames: ['valid-metadata-block'],
|
|
}]);
|
|
});
|
|
|
|
test('validate valid taxonomy', () => {
|
|
const src = `${__dirname}/assets/valid-metadata-block/valid-taxonomy.md`;
|
|
const results = markdownlint.sync({
|
|
customRules: validMetadataBlockRule,
|
|
files: [src],
|
|
});
|
|
|
|
expect(results[src]).toEqual([]);
|
|
});
|