@@ -5,9 +5,38 @@ var unified = require('unified');
55
66// Remark stuff (markdown)
77var parse = require ( 'remark-parse' ) ;
8- var lint = require ( 'remark-lint' ) ;
98var remark2retext = require ( 'remark-retext' ) ;
109var stringify = require ( 'remark-stringify' ) ;
10+ var frontmatter = require ( 'remark-frontmatter' ) ;
11+ var lint = require ( 'remark-lint' ) ;
12+ var headingStyle = require ( 'remark-lint-heading-style' ) ;
13+ var firstHeadingLevel = require ( 'remark-lint-first-heading-level' ) ;
14+ var headingIncrement = require ( 'remark-lint-heading-increment' ) ;
15+ var maximumHeadingLength = require ( 'remark-lint-maximum-heading-length' ) ;
16+ var noDuplicateHeadings = require ( 'remark-lint-no-duplicate-headings' ) ;
17+ var noMultipleToplevelHeadings = require ( 'remark-lint-no-multiple-toplevel-headings' ) ;
18+ var listItemIndent = require ( 'remark-lint-list-item-indent' ) ;
19+ var listItemBulletIndent = require ( 'remark-lint-list-item-bullet-indent' ) ;
20+ var listItemContentIndent = require ( 'remark-lint-list-item-content-indent' ) ;
21+ var unorderedListMarkerStyle = require ( 'remark-lint-unordered-list-marker-style' ) ;
22+ var orderedListMarkerStyle = require ( 'remark-lint-ordered-list-marker-style' ) ;
23+ var emphasisMarker = require ( 'remark-lint-emphasis-marker' ) ;
24+ var strongMarker = require ( 'remark-lint-strong-marker' ) ;
25+ var blockquoteIndentation = require ( 'remark-lint-blockquote-indentation' ) ;
26+ var noMissingBlankLines = require ( 'remark-lint-no-missing-blank-lines' ) ;
27+ var noConsecutiveBlankLines = require ( 'remark-lint-no-consecutive-blank-lines' ) ;
28+ var finalNewline = require ( 'remark-lint-final-newline' ) ;
29+ var noAutoLinkWithoutProtocol = require ( 'remark-lint-no-auto-link-without-protocol' ) ;
30+ var noBlockquoteWithoutMarker = require ( 'remark-lint-no-blockquote-without-marker' ) ;
31+ var noLiteralUrls = require ( 'remark-lint-no-literal-urls' ) ;
32+ var hardBreakSpaces = require ( 'remark-lint-hard-break-spaces' ) ;
33+ var noDuplicateDefinitions = require ( 'remark-lint-no-duplicate-definitions' ) ;
34+ var noHeadingContentIndent = require ( 'remark-lint-no-heading-content-indent' ) ;
35+ var noInlinePadding = require ( 'remark-lint-no-inline-padding' ) ;
36+ var noShortcutReferenceImage = require ( 'remark-lint-no-shortcut-reference-image' ) ;
37+ var noShortcutReferenceLink = require ( 'remark-lint-no-shortcut-reference-link' ) ;
38+ var noUndefinedReferences = require ( 'remark-lint-no-undefined-references' ) ;
39+ var noUnusedDefinitions = require ( 'remark-lint-no-unused-definitions' ) ;
1140
1241// Retext stuff (prose)
1342var english = require ( 'retext-english' ) ;
@@ -53,52 +82,56 @@ if(process.env.FULL_PROSE_CHECK) {
5382
5483// Markdown checking pipeline.
5584var markdown = unified ( )
56- . use ( parse )
85+ . use ( parse , { footnotes : true } )
86+ . use ( stringify )
87+ . use ( frontmatter , 'yaml' )
88+
5789 // https://github.com/wooorm/remark-lint/blob/master/doc/rules.md
58- . use ( lint , {
59- // Headings
60- headingStyle : 'atx' , // ## Headings
61- firstHeadingLevel : 2 , // Page title is h1, so start with h2
62- headingIncrement : true ,
63- maximumHeadingLength : 80 , // FIXME: Eventually remove this
64- noDuplicateHeadings : true ,
65- noMultipleToplevelHeadings : true ,
90+ . use ( lint )
6691
67- // Lists
68- listItemIndent : 'space' , // As the gods intended.
69- listItemBulletIndent : true ,
70- listItemContentIndent : true ,
71- unorderedListMarkerStyle : '*' ,
72- orderedListMarkerStyle : '.' ,
92+ // Headings
93+ . use ( headingStyle , 'atx' ) // ## Headings
94+ . use ( firstHeadingLevel , 2 ) // Page title is h1, so start with h2
95+ . use ( headingIncrement )
96+ . use ( maximumHeadingLength , 80 ) // FIXME: Eventually remove this
97+ . use ( noDuplicateHeadings )
98+ . use ( noMultipleToplevelHeadings )
7399
74- // Misc
75- emphasisMarker : '_' ,
76- strongMarker : '*' ,
77- blockquoteIndentation : 2 ,
78- noMissingBlankLines : { exceptTightLists : true } ,
79- noConsecutiveBlankLines : true ,
80- finalNewline : true ,
81- noAutoLinkWithoutProtocol : true ,
82- noBlockquoteWithoutCaret : true ,
83- noLiteralUrls : true ,
100+ // Lists
101+ . use ( listItemIndent , 'space' ) // As the gods intended.
102+ . use ( listItemBulletIndent )
103+ . use ( listItemContentIndent )
104+ . use ( unorderedListMarkerStyle , '*' )
105+ . use ( orderedListMarkerStyle , '.' )
84106
85- // Mistakes
86- hardBreakSpaces : true ,
87- noDuplicateDefinitions : true ,
88- noHeadingContentIndent : true ,
89- noInlinePadding : true ,
90- noShortcutReferenceImage : true ,
91- noShortcutReferenceLink : true ,
92- noUndefinedReferences : true ,
93- noUnusedDefinitions : true ,
94- } )
95- . use ( remark2retext , prose )
96- . use ( stringify ) ;
107+ // Misc
108+ . use ( emphasisMarker , '_' )
109+ . use ( strongMarker , '*' )
110+ . use ( blockquoteIndentation , 2 )
111+ . use ( noMissingBlankLines , { exceptTightLists : true } )
112+ . use ( noConsecutiveBlankLines )
113+ . use ( finalNewline )
114+ . use ( noAutoLinkWithoutProtocol )
115+ . use ( noBlockquoteWithoutMarker )
116+ . use ( noLiteralUrls )
117+
118+ // Mistakes
119+ . use ( hardBreakSpaces )
120+ . use ( noDuplicateDefinitions )
121+ . use ( noHeadingContentIndent )
122+ . use ( noInlinePadding )
123+ . use ( noShortcutReferenceImage )
124+ . use ( noShortcutReferenceLink )
125+ . use ( noUndefinedReferences )
126+ . use ( noUnusedDefinitions )
127+
128+ // Prose
129+ . use ( remark2retext , prose ) ;
97130
98131async . map ( ignore . filter ( glob . sync ( '_articles/**/*.md' ) ) , function ( filePath , callback ) {
99132 vfile . read ( filePath , function ( err , file ) {
100133 if ( err ) return callback ( err ) ;
101- markdown . process ( file , { footnotes : true } , callback ) ;
134+ markdown . process ( file , callback ) ;
102135 } ) ;
103136} , function ( err , results ) {
104137 console . log ( report ( results ) ) ;
0 commit comments