Skip to content

Commit 229230a

Browse files
chinesedfansindresorhus
authored andcommittedApr 19, 2019
Allow emoji or image after the entry description (#66)
1 parent 97aa4d3 commit 229230a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎rules/list-item.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const listItemLinkNodeWhitelist = new Set([
2828
const listItemDescriptionNodeWhitelist = new Set([
2929
'emphasis',
3030
'footnoteReference',
31+
'html',
32+
'image',
3133
'inlineCode',
3234
'link',
3335
'linkReference',
@@ -38,6 +40,8 @@ const listItemDescriptionNodeWhitelist = new Set([
3840
// Valid node types in list item description suffix
3941
const listItemDescriptionSuffixNodeWhitelist = new Set([
4042
'emphasis',
43+
'html',
44+
'image',
4145
'link',
4246
'strong',
4347
'text'
@@ -168,7 +172,7 @@ function validateListItemDescription(description, file) {
168172
}
169173

170174
// Ensure description ends with '.', '!', '?' or an acceptable special-case
171-
if (!validateListItemSuffix(descriptionText, suffixText)) {
175+
if (suffix.type === 'text' && !validateListItemSuffix(descriptionText, suffixText)) {
172176
file.message('List item description must end with proper punctuation', suffix);
173177
return false;
174178
}

‎test/fixtures/list-item/0.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ All list-items in this document should be linted as **valid**.
44
- [foo](https://foo.com) - A valid description.
55
- [foo](https://foo.com) - A valid description...
66
- [foo](https://foo.com) - A valid description!
7+
- [foo](https://foo.com) - A valid description! ⭐
78
- [foo](https://foo.com) - A valid description!!!
89
- [foo](https://foo.com) - A valid description?
910
- [foo](https://foo.com) - A valid description???
1011
- [foo](https://foo.com) - A valid description????!??
1112
- [foo](https://foo.com) - A valid description with [link](http://bar.org).
13+
- [foo](https://foo.com) - A valid description. ![image](image.png)
14+
- [foo](https://foo.com) - A valid description. <img src="image.png">
1215
- [foo](https://foo.com) - `valid description` here.
1316
- [foo](https://foo.com) - `valid description`.
1417
- [foo](https://foo.com) - VaLid description.

0 commit comments

Comments
 (0)
Please sign in to comment.