@markuplint/markdown-parser 5.0.0-alpha.0 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +5 -5
- package/src/index.spec.ts +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @markuplint/markdown-parser
|
|
9
|
+
|
|
6
10
|
# [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
|
|
7
11
|
|
|
8
12
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/markdown-parser",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.1",
|
|
4
4
|
"description": "Markdown parser for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"clean": "tsc --build --clean tsconfig.build.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@markuplint/html-parser": "5.0.0-alpha.
|
|
28
|
-
"@markuplint/ml-ast": "5.0.0-alpha.
|
|
29
|
-
"@markuplint/parser-utils": "5.0.0-alpha.
|
|
27
|
+
"@markuplint/html-parser": "5.0.0-alpha.1",
|
|
28
|
+
"@markuplint/ml-ast": "5.0.0-alpha.1",
|
|
29
|
+
"@markuplint/parser-utils": "5.0.0-alpha.1",
|
|
30
30
|
"remark-frontmatter": "5.0.0",
|
|
31
31
|
"remark-gfm": "4.0.1",
|
|
32
32
|
"remark-parse": "11.0.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/mdast": "4.0.4"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "78a295e73a097a1ce09c777c06fa21ab68136387"
|
|
39
39
|
}
|
package/src/index.spec.ts
CHANGED
|
@@ -584,6 +584,31 @@ describe('MarkdownParser', () => {
|
|
|
584
584
|
});
|
|
585
585
|
});
|
|
586
586
|
|
|
587
|
+
describe('GFM autolink (email)', () => {
|
|
588
|
+
test('plain email address is autolinked to <a> with mailto href', () => {
|
|
589
|
+
const doc = parse('user@example.com');
|
|
590
|
+
const a = doc.nodeList.find(n => n?.type === 'starttag' && n.nodeName === 'a');
|
|
591
|
+
expect(a).toBeDefined();
|
|
592
|
+
const href = a!.attributes.find(attr => attr.type === 'attr' && attr.name.raw === 'href');
|
|
593
|
+
expect(href).toBeDefined();
|
|
594
|
+
expect(href!.value.raw).toBe('mailto:user@example.com');
|
|
595
|
+
// Should have text child with the email address
|
|
596
|
+
const text = a!.childNodes.find(c => c.type === 'text');
|
|
597
|
+
expect(text).toBeDefined();
|
|
598
|
+
expect(text!.raw).toBe('user@example.com');
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
test('email address in list item is autolinked', () => {
|
|
602
|
+
const doc = parse('- user@example.com or admin@example.org');
|
|
603
|
+
const links = doc.nodeList.filter(n => n?.type === 'starttag' && n.nodeName === 'a');
|
|
604
|
+
expect(links.length).toBe(2);
|
|
605
|
+
const hrefValues = links.map(
|
|
606
|
+
l => l.attributes.find(a => a.type === 'attr' && a.name.raw === 'href')?.value.raw,
|
|
607
|
+
);
|
|
608
|
+
expect(hrefValues).toStrictEqual(['mailto:user@example.com', 'mailto:admin@example.org']);
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
|
|
587
612
|
describe('Edge cases', () => {
|
|
588
613
|
test('empty input produces empty nodeList', () => {
|
|
589
614
|
const doc = parse('');
|