Remove support for dash at end of name
This commit is contained in:
parent
71af94adb5
commit
472c259375
3 changed files with 17 additions and 6 deletions
|
@ -27,7 +27,8 @@ export function factoryName(effects, ok, nok, nameType) {
|
|||
}
|
||||
|
||||
effects.exit(nameType)
|
||||
// To do next major: disallow `-` at end of name too, for consistency.
|
||||
return self.previous === codes.underscore ? nok(code) : ok(code)
|
||||
return self.previous === codes.dash || self.previous === codes.underscore
|
||||
? nok(code)
|
||||
: ok(code)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ He dies.
|
|||
|
||||
The `name` part is required. The first character must be a letter, other
|
||||
characters can be alphanumerical, `-`, and `_`.
|
||||
`_` cannot end a name.
|
||||
`-` or `_` cannot end a name.
|
||||
|
||||
The `[label]` part is optional (`:x` and `:x[]` are equivalent)†.
|
||||
When used, it can include text constructs such as emphasis and so on: `x[a *b*
|
||||
|
|
|
@ -62,11 +62,17 @@ test('micromark-extension-directive (syntax)', (t) => {
|
|||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':a-', options()),
|
||||
micromark(':a-b', options()),
|
||||
'<p></p>',
|
||||
'should support a dash in a name'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':a-', options()),
|
||||
'<p>:a-</p>',
|
||||
'should *not* support a dash at the end of a name'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':a_b', options()),
|
||||
'<p></p>',
|
||||
|
@ -403,7 +409,11 @@ test('micromark-extension-directive (syntax)', (t) => {
|
|||
'should support a digit in a name'
|
||||
)
|
||||
|
||||
t.equal(micromark('::a-', options()), '', 'should support a dash in a name')
|
||||
t.equal(
|
||||
micromark('::a-b', options()),
|
||||
'',
|
||||
'should support a dash in a name'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark('::a[', options()),
|
||||
|
@ -744,7 +754,7 @@ test('micromark-extension-directive (syntax)', (t) => {
|
|||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':::a-', options()),
|
||||
micromark(':::a-b', options()),
|
||||
'',
|
||||
'should support a dash in a name'
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue