Skip to content

Commit df188d4

Browse files
author
Peter Bengtsson
authored
Capitalization only needed first word is character (#49130)
1 parent 0701a26 commit df188d4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/content-linter/lib/linting-rules/list-first-word-capitalization.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export const listFirstWordCapitalization = {
3232
const content = token.content.trim()
3333
const firstWord = content.trim().split(' ')[0]
3434

35-
// Liquid is considered a text node but we don't want to capitalize it
36-
if (firstWord.startsWith('[{%') || firstWord.startsWith('{%') || firstWord.startsWith('{{'))
37-
return
35+
// If the first character in the first word is not an alphanumeric,
36+
// don't bother. For example `"ubunut-latest"` or `{% data ... %}`.
37+
if (/^[^a-z]/i.test(firstWord)) return
3838
// If the first letter is capitalized, it's not an error
3939
// And any special characters (like @) that can't be capitalized
4040
if (/[A-Z@]/.test(firstWord[0])) return

src/content-linter/tests/unit/list-first-word-captitalization.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ describe(listFirstWordCapitalization.names.join(' - '), () => {
5454
'- @mention your friends',
5555
'- @hash tags',
5656
'- 05:00',
57+
'- "keyword" starts with a quotation sign',
5758
].join('\n')
5859
const result = await runRule(listFirstWordCapitalization, { strings: { markdown } })
5960
const errors = result.markdown

0 commit comments

Comments
 (0)