Skip to content

Commit 6412e60

Browse files
authored
Merge pull request #1 from nwidger/main
Improve support for Hugo shortcodes with no closing tag
2 parents ef486c7 + 2fa6bf7 commit 6412e60

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Hugo/.vale.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[*.md]
22
# Exclude `{{< ... >}}`, `{{% ... %}}`, [Who]({{< ... >}})
33
TokenIgnores = ({{[%<] .* [%>]}}.*?{{[%<] ?/.* [%>]}}), \
4-
(\[.+\]\({{< .+ >}}\))
4+
(\[.+\]\({{< .+ >}}\)), \
5+
({{[%<] .+ [%>]}})
56

67
# Exclude `{{< myshortcode `This is some <b>HTML</b>, ... >}}`
78
BlockIgnores = (?sm)^({{[%<] [^{]*? [%>]}})\n$, \
8-
(?s) *({{< highlight [^>]* ?>}}.*?{{< ?/ ?highlight >}})
9+
(?s) *({{< highlight [^>]* ?>}}.*?{{< ?/ ?highlight >}}), \
10+
({{[%<] .+ [%>]}})

testdata/shortcodes/.vale.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ BasedOnStyles = Vale
33

44
# Exclude `{{< ... >}}`, `{{% ... %}}`, [Who]({{< ... >}})
55
TokenIgnores = ({{[%<] .* [%>]}}.*?{{[%<] ?/.* [%>]}}), \
6-
(\[.+\]\({{< .+ >}}\))
6+
(\[.+\]\({{< .+ >}}\)), \
7+
({{[%<] .+ [%>]}})
78

89
# Exclude `{{< myshortcode `This is some <b>HTML</b>, ... >}}`
910
BlockIgnores = (?sm)^({{[%<] [^{]*? [%>]}})\n$, \
10-
(?s) *({{< highlight [^>]* ?>}}.*?{{< ?/ ?highlight >}})
11+
(?s) *({{< highlight [^>]* ?>}}.*?{{< ?/ ?highlight >}}), \
12+
({{[%<] .+ [%>]}})

testdata/shortcodes/test.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ Shortcodes are non-standard markup that appears within normal Markdown.
5252
[Contact us]({{< relref "contact/index.md" >}}) if you have any questions.
5353

5454
Shortcodes are non-standard markup that appears within normal Markdown.
55+
56+
- {{< myshortcode src="/media/spf13.jpg" title="Steve Francia" >}}
57+
58+
Shortcodes are non-standard markup that appears within normal Markdown.
59+
60+
Shortcodes can be used {{< myshortcode src="/media/spf13.jpg" title="Steve Francia" >}} inside a paragraph.
61+
62+
Shortcodes are non-standard markup that appears within normal Markdown.

testdata/test.ct

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ test.md:42:1:Vale.Spelling:Did you really mean 'Shortcodes'?
1212
test.md:46:1:Vale.Spelling:Did you really mean 'hidecaption'?
1313
test.md:50:1:Vale.Spelling:Did you really mean 'Shortcodes'?
1414
test.md:54:1:Vale.Spelling:Did you really mean 'Shortcodes'?
15+
test.md:58:1:Vale.Spelling:Did you really mean 'Shortcodes'?
16+
test.md:60:1:Vale.Spelling:Did you really mean 'Shortcodes'?
17+
test.md:62:1:Vale.Spelling:Did you really mean 'Shortcodes'?

0 commit comments

Comments
 (0)