├── .remarkignore
├── .npmrc
├── .prettierignore
├── .gitattributes
├── .gitignore
├── index.js
├── test
├── fixture
│ ├── algorithm-2d.md
│ ├── algorithm-2e.md
│ ├── links-autolink-literals-and-characters.md
│ ├── algorithm-2e.html
│ ├── algorithm-2d.html
│ ├── links-autolink-literals-and-characters.html
│ ├── algorithm-2c.md
│ ├── brackets.md
│ ├── www-domain-start.md
│ ├── www-domain-continue.md
│ ├── path-or-link-end.md
│ ├── www-domain-dot.md
│ ├── www-path-start.md
│ ├── www-path-continue.md
│ ├── http-domain-start.md
│ ├── domain-character-reference-like-named.md
│ ├── http-domain-continue.md
│ ├── http-domain-start.html
│ ├── combined-with-images.md
│ ├── http-path-start.md
│ ├── path-character-reference-like-named.md
│ ├── domain-character-reference-like-numerical.md
│ ├── http-path-continue.md
│ ├── algorithm-2c.html
│ ├── path-character-reference-like-numerical.md
│ ├── brackets.html
│ ├── email-tld-digits.md
│ ├── path-or-link-end.html
│ ├── algorithm-2b.md
│ ├── combined-with-images.html
│ ├── email-tld-digits.html
│ ├── www-domain-start.html
│ ├── http-domain-continue.html
│ ├── www-domain-continue.html
│ ├── http-path-start.html
│ ├── www-domain-dot.html
│ ├── www-path-start.html
│ ├── combined-with-links.md
│ ├── http-path-continue.html
│ ├── previous.md
│ ├── www-path-continue.html
│ ├── domain-character-reference-like-named.html
│ ├── algorithm-2.md
│ ├── path-character-reference-like-named.html
│ ├── domain-character-reference-like-numerical.html
│ ├── path-character-reference-like-numerical.html
│ ├── previous-complex.md
│ ├── base.md
│ ├── algorithm-2b.html
│ ├── combined-with-links.html
│ ├── previous.html
│ ├── base.html
│ ├── algorithm-2.html
│ └── previous-complex.html
└── index.js
├── .editorconfig
├── .github
└── workflows
│ ├── bb.yml
│ └── main.yml
├── tsconfig.json
├── license
├── package.json
├── lib
└── index.js
└── readme.md
/.remarkignore:
--------------------------------------------------------------------------------
1 | test/
2 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | ignore-scripts=true
2 | package-lock=false
3 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | coverage/
2 | *.html
3 | *.md
4 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # https://github.com/github/linguist/blob/HEAD/docs/overrides.md
2 | test/**/*.html linguist-vendored
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.d.ts
2 | *.log
3 | *.map
4 | *.tsbuildinfo
5 | .DS_Store
6 | coverage/
7 | node_modules/
8 | yarn.lock
9 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | export {
2 | gfmAutolinkLiteralFromMarkdown,
3 | gfmAutolinkLiteralToMarkdown
4 | } from './lib/index.js'
5 |
--------------------------------------------------------------------------------
/test/fixture/algorithm-2d.md:
--------------------------------------------------------------------------------
1 | [ www.commonmark.org/he
www.example.com/a&bogus;
5 | 6 | 7 | -------------------------------------------------------------------------------- /test/fixture/algorithm-2c.md: -------------------------------------------------------------------------------- 1 | [ http://a.com/search?q=commonmark&hl;=en 2 | 3 | [ http://a.com/search?q=commonmark&hl; 4 | 5 | [ http://a.com/search?q=commonmark&hl;b 6 | 7 | [ http://a.com/search?q=commonmark&hl;d 8 | 9 | [ http://a.com/search?q=commonmark©=en 10 | 11 | [ http://a.com/search?q=commonmark© 12 | 13 | [ http://a.com/search?q=commonmark©b 14 | 15 | [ http://a.com/search?q=commonmark©d 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "checkJs": true, 4 | "customConditions": ["development"], 5 | "declarationMap": true, 6 | "declaration": true, 7 | "emitDeclarationOnly": true, 8 | "exactOptionalPropertyTypes": true, 9 | "lib": ["es2022"], 10 | "module": "node16", 11 | "strict": true, 12 | "target": "es2022" 13 | }, 14 | "exclude": ["coverage/", "node_modules/"], 15 | "include": ["**/*.js"] 16 | } 17 | -------------------------------------------------------------------------------- /test/fixture/brackets.md: -------------------------------------------------------------------------------- 1 | H0. 2 | 3 | [https://a.com©b 4 | 5 | [www.a.com©b 6 | 7 | H1. 8 | 9 | []https://a.com©b 10 | 11 | []www.a.com©b 12 | 13 | H2. 14 | 15 | [] https://a.com©b 16 | 17 | [] www.a.com©b 18 | 19 | H3. 20 | 21 | [[https://a.com©b 22 | 23 | [[www.a.com©b 24 | 25 | H4. 26 | 27 | [[]https://a.com©b 28 | 29 | [[]www.a.com©b 30 | 31 | H5. 32 | 33 | [[]]https://a.com©b 34 | 35 | [[]]www.a.com©b 36 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | main: 3 | name: ${{matrix.node}} 4 | runs-on: ubuntu-latest 5 | steps: 6 | - uses: actions/checkout@v4 7 | - uses: actions/setup-node@v4 8 | with: 9 | node-version: ${{matrix.node}} 10 | - run: npm install 11 | - run: npm test 12 | - uses: codecov/codecov-action@v5 13 | strategy: 14 | matrix: 15 | node: 16 | - lts/hydrogen 17 | - node 18 | name: main 19 | on: 20 | - pull_request 21 | - push 22 | -------------------------------------------------------------------------------- /test/fixture/www-domain-start.md: -------------------------------------------------------------------------------- 1 | # wwwtf? 2 | 3 | www. (space) 4 | 5 | www.! 6 | 7 | www." 8 | 9 | www.# 10 | 11 | www.$ 12 | 13 | www.% 14 | 15 | www.& 16 | 17 | www.' 18 | 19 | www.( 20 | 21 | www.) 22 | 23 | www.* 24 | 25 | www.+ 26 | 27 | www., 28 | 29 | www.- 30 | 31 | www. 32 | 33 | www.. 34 | 35 | www./ 36 | 37 | www.: 38 | 39 | www.; 40 | 41 | www.< 42 | 43 | www.= 44 | 45 | www.> 46 | 47 | www.? 48 | 49 | www.@ 50 | 51 | www.[ 52 | 53 | www.\ 54 | 55 | www.] 56 | 57 | www.^ 58 | 59 | www._ 60 | 61 | www.` 62 | 63 | www.{ 64 | 65 | www.| 66 | 67 | www.} 68 | 69 | www.~ 70 | -------------------------------------------------------------------------------- /test/fixture/www-domain-continue.md: -------------------------------------------------------------------------------- 1 | # wwwtf 2? 2 | 3 | www.a (space) 4 | 5 | www.a! 6 | 7 | www.a" 8 | 9 | www.a# 10 | 11 | www.a$ 12 | 13 | www.a% 14 | 15 | www.a& 16 | 17 | www.a' 18 | 19 | www.a( 20 | 21 | www.a) 22 | 23 | www.a* 24 | 25 | www.a+ 26 | 27 | www.a, 28 | 29 | www.a- 30 | 31 | www.a 32 | 33 | www.a. 34 | 35 | www.a/ 36 | 37 | www.a: 38 | 39 | www.a; 40 | 41 | www.a< 42 | 43 | www.a= 44 | 45 | www.a> 46 | 47 | www.a? 48 | 49 | www.a@ 50 | 51 | www.a[ 52 | 53 | www.a\ 54 | 55 | www.a] 56 | 57 | www.a^ 58 | 59 | www.a_ 60 | 61 | www.a` 62 | 63 | www.a{ 64 | 65 | www.a| 66 | 67 | www.a} 68 | 69 | www.a~ 70 | -------------------------------------------------------------------------------- /test/fixture/path-or-link-end.md: -------------------------------------------------------------------------------- 1 | In autolink literal path or link end? 2 | 3 | [https://a.com/d]() 4 | 5 | [http://a.com/d]() 6 | 7 | [www.a.com/d]() 8 | 9 | https://a.com/d]() 10 | 11 | http://a.com/d]() 12 | 13 | www.a.com/d]() 14 | 15 | In autolink literal search or link end? 16 | 17 | [https://a.com?d]() 18 | 19 | [http://a.com?d]() 20 | 21 | [www.a.com?d]() 22 | 23 | https://a.com?d]() 24 | 25 | http://a.com?d]() 26 | 27 | www.a.com?d]() 28 | 29 | In autolink literal hash or link end? 30 | 31 | [https://a.com#d]() 32 | 33 | [http://a.com#d]() 34 | 35 | [www.a.com#d]() 36 | 37 | https://a.com#d]() 38 | 39 | http://a.com#d]() 40 | 41 | www.a.com#d]() 42 | -------------------------------------------------------------------------------- /test/fixture/www-domain-dot.md: -------------------------------------------------------------------------------- 1 | # wwwtf 5? 2 | 3 | www.a. (space) 4 | 5 | www.a.! 6 | 7 | www.a." 8 | 9 | www.a.# 10 | 11 | www.a.$ 12 | 13 | www.a.% 14 | 15 | www.a.& 16 | 17 | www.a.' 18 | 19 | www.a.( 20 | 21 | www.a.) 22 | 23 | www.a.* 24 | 25 | www.a.+ 26 | 27 | www.a., 28 | 29 | www.a.- 30 | 31 | www.a. 32 | 33 | www.a.. 34 | 35 | www.a./ 36 | 37 | www.a.: 38 | 39 | www.a.; 40 | 41 | www.a.< 42 | 43 | www.a.= 44 | 45 | www.a.> 46 | 47 | www.a.? 48 | 49 | www.a.@ 50 | 51 | www.a.[ 52 | 53 | www.a.\ 54 | 55 | www.a.] 56 | 57 | www.a.^ 58 | 59 | www.a._ 60 | 61 | www.a.` 62 | 63 | www.a.{ 64 | 65 | www.a.| 66 | 67 | www.a.} 68 | 69 | www.a.~ 70 | -------------------------------------------------------------------------------- /test/fixture/www-path-start.md: -------------------------------------------------------------------------------- 1 | # wwwtf? (3) 2 | 3 | www.a/ (space) 4 | 5 | www.a/! 6 | 7 | www.a/" 8 | 9 | www.a/# 10 | 11 | www.a/$ 12 | 13 | www.a/% 14 | 15 | www.a/& 16 | 17 | www.a/' 18 | 19 | www.a/( 20 | 21 | www.a/) 22 | 23 | www.a/* 24 | 25 | www.a/+ 26 | 27 | www.a/, 28 | 29 | www.a/- 30 | 31 | www.a/ 32 | 33 | www.a/. 34 | 35 | www.a// 36 | 37 | www.a/: 38 | 39 | www.a/; 40 | 41 | www.a/< 42 | 43 | www.a/= 44 | 45 | www.a/> 46 | 47 | www.a/? 48 | 49 | www.a/@ 50 | 51 | www.a/[ 52 | 53 | www.a/\ 54 | 55 | www.a/] 56 | 57 | www.a/^ 58 | 59 | www.a/_ 60 | 61 | www.a/` 62 | 63 | www.a/{ 64 | 65 | www.a/| 66 | 67 | www.a/} 68 | 69 | www.a/~ 70 | -------------------------------------------------------------------------------- /test/fixture/www-path-continue.md: -------------------------------------------------------------------------------- 1 | # wwwtf? (4) 2 | 3 | www.a/b (space) 4 | 5 | www.a/b! 6 | 7 | www.a/b" 8 | 9 | www.a/b# 10 | 11 | www.a/b$ 12 | 13 | www.a/b% 14 | 15 | www.a/b& 16 | 17 | www.a/b' 18 | 19 | www.a/b( 20 | 21 | www.a/b) 22 | 23 | www.a/b* 24 | 25 | www.a/b+ 26 | 27 | www.a/b, 28 | 29 | www.a/b- 30 | 31 | www.a/b 32 | 33 | www.a/b. 34 | 35 | www.a/b/ 36 | 37 | www.a/b: 38 | 39 | www.a/b; 40 | 41 | www.a/b< 42 | 43 | www.a/b= 44 | 45 | www.a/b> 46 | 47 | www.a/b? 48 | 49 | www.a/b@ 50 | 51 | www.a/b[ 52 | 53 | www.a/b\ 54 | 55 | www.a/b] 56 | 57 | www.a/b^ 58 | 59 | www.a/b_ 60 | 61 | www.a/b` 62 | 63 | www.a/b{ 64 | 65 | www.a/b| 66 | 67 | www.a/b} 68 | 69 | www.a/b~ 70 | -------------------------------------------------------------------------------- /test/fixture/http-domain-start.md: -------------------------------------------------------------------------------- 1 | # httpshhh? (1) 2 | 3 | http:// (space) 4 | 5 | http://! 6 | 7 | http://" 8 | 9 | http://# 10 | 11 | http://$ 12 | 13 | http://% 14 | 15 | http://& 16 | 17 | http://' 18 | 19 | http://( 20 | 21 | http://) 22 | 23 | http://* 24 | 25 | http://+ 26 | 27 | http://, 28 | 29 | http://- 30 | 31 | http:// 32 | 33 | http://. 34 | 35 | http:/// 36 | 37 | http://: 38 | 39 | http://; 40 | 41 | http://< 42 | 43 | http://= 44 | 45 | http://> 46 | 47 | http://? 48 | 49 | http://@ 50 | 51 | http://[ 52 | 53 | http://\ 54 | 55 | http://] 56 | 57 | http://^ 58 | 59 | http://_ 60 | 61 | http://` 62 | 63 | http://{ 64 | 65 | http://| 66 | 67 | http://} 68 | 69 | http://~ 70 | -------------------------------------------------------------------------------- /test/fixture/domain-character-reference-like-named.md: -------------------------------------------------------------------------------- 1 | # “character reference” 2 | 3 | www.a&b (space) 4 | 5 | www.a&b! 6 | 7 | www.a&b" 8 | 9 | www.a&b# 10 | 11 | www.a&b$ 12 | 13 | www.a&b% 14 | 15 | www.a&b& 16 | 17 | www.a&b' 18 | 19 | www.a&b( 20 | 21 | www.a&b) 22 | 23 | www.a&b* 24 | 25 | www.a&b+ 26 | 27 | www.a&b, 28 | 29 | www.a&b- 30 | 31 | www.a&b 32 | 33 | www.a&b. 34 | 35 | www.a&b/ 36 | 37 | www.a&b: 38 | 39 | www.a&b; 40 | 41 | www.a&b< 42 | 43 | www.a&b= 44 | 45 | www.a&b> 46 | 47 | www.a&b? 48 | 49 | www.a&b@ 50 | 51 | www.a&b[ 52 | 53 | www.a&b\ 54 | 55 | www.a&b] 56 | 57 | www.a&b^ 58 | 59 | www.a&b_ 60 | 61 | www.a&b` 62 | 63 | www.a&b{ 64 | 65 | www.a&b| 66 | 67 | www.a&b} 68 | 69 | www.a&b~ 70 | -------------------------------------------------------------------------------- /test/fixture/http-domain-continue.md: -------------------------------------------------------------------------------- 1 | # httpshhh? (2) 2 | 3 | http://a (space) 4 | 5 | http://a! 6 | 7 | http://a" 8 | 9 | http://a# 10 | 11 | http://a$ 12 | 13 | http://a% 14 | 15 | http://a& 16 | 17 | http://a' 18 | 19 | http://a( 20 | 21 | http://a) 22 | 23 | http://a* 24 | 25 | http://a+ 26 | 27 | http://a, 28 | 29 | http://a- 30 | 31 | http://a 32 | 33 | http://a. 34 | 35 | http://a/ 36 | 37 | http://a: 38 | 39 | http://a; 40 | 41 | http://a< 42 | 43 | http://a= 44 | 45 | http://a> 46 | 47 | http://a? 48 | 49 | http://a@ 50 | 51 | http://a[ 52 | 53 | http://a\ 54 | 55 | http://a] 56 | 57 | http://a^ 58 | 59 | http://a_ 60 | 61 | http://a` 62 | 63 | http://a{ 64 | 65 | http://a| 66 | 67 | http://a} 68 | 69 | http://a~ 70 | -------------------------------------------------------------------------------- /test/fixture/http-domain-start.html: -------------------------------------------------------------------------------- 1 |http:// (space)
3 |http://!
4 |http://"
5 |http://#
6 |http://$
7 |http://%
8 |http://&
9 |http://'
10 |http://(
11 |http://)
12 |http://*
13 |http://+
14 |http://,
15 |http://-
16 |http://
17 |http://.
18 |http:///
19 |http://:
20 |http://;
21 |http://<
22 |http://=
23 |http://>
24 |http://?
25 |http://@
26 |http://[
27 |http://\
28 |http://]
29 |http://^
30 |http://_
31 |http://`
32 |http://{
33 |http://|
34 |http://}
35 |http://~
36 | -------------------------------------------------------------------------------- /test/fixture/combined-with-images.md: -------------------------------------------------------------------------------- 1 | Image start. 2 | 3 | ![https://a.com 4 | 5 | ![http://a.com 6 | 7 | ![www.a.com 8 | 9 | ![a@b.c 10 | 11 | Image start and label end. 12 | 13 | ![https://a.com] 14 | 15 | ![http://a.com] 16 | 17 | ![www.a.com] 18 | 19 | ![a@b.c] 20 | 21 | Image label with reference (note: GH cleans hashes here, but we keep them in). 22 | 23 | ![https://a.com][x] 24 | 25 | ![http://a.com][x] 26 | 27 | ![www.a.com][x] 28 | 29 | ![a@b.c][x] 30 | 31 | [x]: # 32 | 33 | Image label with resource. 34 | 35 | ![https://a.com]() 36 | 37 | ![http://a.com]() 38 | 39 | ![www.a.com]() 40 | 41 | ![a@b.c]() 42 | 43 | Autolink literal after image. 44 | 45 | ![a]() https://a.com 46 | 47 | ![a]() http://a.com 48 | 49 | ![a]() www.a.com 50 | 51 | ![a]() a@b.c 52 | -------------------------------------------------------------------------------- /test/fixture/http-path-start.md: -------------------------------------------------------------------------------- 1 | # httpshhh? (3) 2 | 3 | http://a/ (space) 4 | 5 | http://a/! 6 | 7 | http://a/" 8 | 9 | http://a/# 10 | 11 | http://a/$ 12 | 13 | http://a/% 14 | 15 | http://a/& 16 | 17 | http://a/' 18 | 19 | http://a/( 20 | 21 | http://a/) 22 | 23 | http://a/* 24 | 25 | http://a/+ 26 | 27 | http://a/, 28 | 29 | http://a/- 30 | 31 | http://a/ 32 | 33 | http://a/. 34 | 35 | http://a// 36 | 37 | http://a/: 38 | 39 | http://a/; 40 | 41 | http://a/< 42 | 43 | http://a/= 44 | 45 | http://a/> 46 | 47 | http://a/? 48 | 49 | http://a/@ 50 | 51 | http://a/[ 52 | 53 | http://a/\ 54 | 55 | http://a/] 56 | 57 | http://a/^ 58 | 59 | http://a/_ 60 | 61 | http://a/` 62 | 63 | http://a/{ 64 | 65 | http://a/| 66 | 67 | http://a/} 68 | 69 | http://a/~ 70 | -------------------------------------------------------------------------------- /test/fixture/path-character-reference-like-named.md: -------------------------------------------------------------------------------- 1 | # “character reference” 2 | 3 | www.a/b&c (space) 4 | 5 | www.a/b&c! 6 | 7 | www.a/b&c" 8 | 9 | www.a/b&c# 10 | 11 | www.a/b&c$ 12 | 13 | www.a/b&c% 14 | 15 | www.a/b&c& 16 | 17 | www.a/b&c' 18 | 19 | www.a/b&c( 20 | 21 | www.a/b&c) 22 | 23 | www.a/b&c* 24 | 25 | www.a/b&c+ 26 | 27 | www.a/b&c, 28 | 29 | www.a/b&c- 30 | 31 | www.a/b&c 32 | 33 | www.a/b&c. 34 | 35 | www.a/b&c/ 36 | 37 | www.a/b&c: 38 | 39 | www.a/b&c; 40 | 41 | www.a/b&c< 42 | 43 | www.a/b&c= 44 | 45 | www.a/b&c> 46 | 47 | www.a/b&c? 48 | 49 | www.a/b&c@ 50 | 51 | www.a/b&c[ 52 | 53 | www.a/b&c\ 54 | 55 | www.a/b&c] 56 | 57 | www.a/b&c^ 58 | 59 | www.a/b&c_ 60 | 61 | www.a/b&c` 62 | 63 | www.a/b&c{ 64 | 65 | www.a/b&c| 66 | 67 | www.a/b&c} 68 | 69 | www.a/b&c~ 70 | -------------------------------------------------------------------------------- /test/fixture/domain-character-reference-like-numerical.md: -------------------------------------------------------------------------------- 1 | # “character reference” 2 | 3 | www.a# (space) 4 | 5 | www.a#! 6 | 7 | www.a#" 8 | 9 | www.a## 10 | 11 | www.a#$ 12 | 13 | www.a#% 14 | 15 | www.a#& 16 | 17 | www.a#' 18 | 19 | www.a#( 20 | 21 | www.a#) 22 | 23 | www.a#* 24 | 25 | www.a#+ 26 | 27 | www.a#, 28 | 29 | www.a#- 30 | 31 | www.a# 32 | 33 | www.a#. 34 | 35 | www.a#/ 36 | 37 | www.a#: 38 | 39 | www.a# 40 | 41 | www.a#< 42 | 43 | www.a#= 44 | 45 | www.a#> 46 | 47 | www.a#? 48 | 49 | www.a#@ 50 | 51 | www.a#[ 52 | 53 | www.a#\ 54 | 55 | www.a#] 56 | 57 | www.a#^ 58 | 59 | www.a#_ 60 | 61 | www.a#` 62 | 63 | www.a#{ 64 | 65 | www.a#| 66 | 67 | www.a#} 68 | 69 | www.a#~ 70 | -------------------------------------------------------------------------------- /test/fixture/http-path-continue.md: -------------------------------------------------------------------------------- 1 | # httpshhh? (4) 2 | 3 | http://a/b (space) 4 | 5 | http://a/b! 6 | 7 | http://a/b" 8 | 9 | http://a/b# 10 | 11 | http://a/b$ 12 | 13 | http://a/b% 14 | 15 | http://a/b& 16 | 17 | http://a/b' 18 | 19 | http://a/b( 20 | 21 | http://a/b) 22 | 23 | http://a/b* 24 | 25 | http://a/b+ 26 | 27 | http://a/b, 28 | 29 | http://a/b- 30 | 31 | http://a/b 32 | 33 | http://a/b. 34 | 35 | http://a/b/ 36 | 37 | http://a/b: 38 | 39 | http://a/b; 40 | 41 | http://a/b< 42 | 43 | http://a/b= 44 | 45 | http://a/b> 46 | 47 | http://a/b? 48 | 49 | http://a/b@ 50 | 51 | http://a/b[ 52 | 53 | http://a/b\ 54 | 55 | http://a/b] 56 | 57 | http://a/b^ 58 | 59 | http://a/b_ 60 | 61 | http://a/b` 62 | 63 | http://a/b{ 64 | 65 | http://a/b| 66 | 67 | http://a/b} 68 | 69 | http://a/b~ 70 | -------------------------------------------------------------------------------- /test/fixture/algorithm-2c.html: -------------------------------------------------------------------------------- 1 |[ http://a.com/search?q=commonmark&hl;=en
2 |[ http://a.com/search?q=commonmark&hl;
3 |[ http://a.com/search?q=commonmark&hl;b
4 |[ http://a.com/search?q=commonmark&hl;d
5 |[ http://a.com/search?q=commonmark©=en
6 |[ http://a.com/search?q=commonmark©
7 |[ http://a.com/search?q=commonmark©b
8 |[ http://a.com/search?q=commonmark©d
9 | -------------------------------------------------------------------------------- /test/fixture/path-character-reference-like-numerical.md: -------------------------------------------------------------------------------- 1 | # “character reference” 2 | 3 | www.a/b# (space) 4 | 5 | www.a/b#! 6 | 7 | www.a/b#" 8 | 9 | www.a/b## 10 | 11 | www.a/b#$ 12 | 13 | www.a/b#% 14 | 15 | www.a/b#& 16 | 17 | www.a/b#' 18 | 19 | www.a/b#( 20 | 21 | www.a/b#) 22 | 23 | www.a/b#* 24 | 25 | www.a/b#+ 26 | 27 | www.a/b#, 28 | 29 | www.a/b#- 30 | 31 | www.a/b# 32 | 33 | www.a/b#. 34 | 35 | www.a/b#/ 36 | 37 | www.a/b#: 38 | 39 | www.a/b# 40 | 41 | www.a/b#< 42 | 43 | www.a/b#= 44 | 45 | www.a/b#> 46 | 47 | www.a/b#? 48 | 49 | www.a/b#@ 50 | 51 | www.a/b#[ 52 | 53 | www.a/b#\ 54 | 55 | www.a/b#] 56 | 57 | www.a/b#^ 58 | 59 | www.a/b#_ 60 | 61 | www.a/b#` 62 | 63 | www.a/b#{ 64 | 65 | www.a/b#| 66 | 67 | www.a/b#} 68 | 69 | www.a/b#~ 70 | -------------------------------------------------------------------------------- /test/fixture/brackets.html: -------------------------------------------------------------------------------- 1 |H0.
2 | 3 | 4 |H1.
5 | 6 | 7 |H2.
8 | 9 | 10 |H3.
11 | 12 | 13 |H4.
14 | 15 |[[]www.a.com©b
16 |H5.
17 | 18 |[[]]www.a.com©b
19 | -------------------------------------------------------------------------------- /test/fixture/email-tld-digits.md: -------------------------------------------------------------------------------- 1 | a@0.0 2 | 3 | a@0.b 4 | 5 | a@a.29 6 | 7 | a@a.b 8 | 9 | a@0.0.c 10 | 11 | react@0.11.1 12 | 13 | react@0.12.0-rc1 14 | 15 | react@0.14.0-alpha1 16 | 17 | react@16.7.0-alpha.2 18 | 19 | react@0.0.0-experimental-aae83a4b9 20 | 21 | [ react@0.11.1 22 | 23 | [ react@0.12.0-rc1 24 | 25 | [ react@0.14.0-alpha1 26 | 27 | [ react@16.7.0-alpha.2 28 | 29 | [ react@0.0.0-experimental-aae83a4b9 30 | 31 | --- 32 | 33 | react@a 34 | 35 | react@1 36 | 37 | react@1.a 38 | 39 | react@1.1 40 | 41 | react@1.a-b 42 | 43 | react@1.a1b 44 | 45 | react@1.1-b 46 | 47 | react@1.1-alpha 48 | 49 | react@1.1-alpha1 50 | 51 | react@1.1-a 52 | 53 | react@1.a-1 54 | 55 | --- 56 | 57 | [ react@a 58 | 59 | [ react@1 60 | 61 | [ react@1.a 62 | 63 | [ react@1.1 64 | 65 | [ react@1.a-b 66 | 67 | [ react@1.a1b 68 | 69 | [ react@1.1-b 70 | 71 | [ react@1.1-alpha 72 | 73 | [ react@1.1-alpha1 74 | 75 | [ react@1.1-a 76 | 77 | [ react@1.a-1 78 | -------------------------------------------------------------------------------- /test/fixture/path-or-link-end.html: -------------------------------------------------------------------------------- 1 |In autolink literal path or link end?
2 | 3 | 4 | 5 | 6 | 7 |www.a.com/d]()
8 |In autolink literal search or link end?
9 | 10 | 11 | 12 | 13 | 14 |www.a.com?d]()
15 |In autolink literal hash or link end?
16 | 17 | 18 | 19 | 20 | 21 |www.a.com#d]()
22 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) Titus WormerImage start.
2 | 3 | 4 | 5 |![a@b.c
6 |Image start and label end.
7 | 8 |![http://a.com]
9 |![www.a.com]
10 |![a@b.c]
11 |Image label with reference (note: GH cleans hashes here, but we keep them in).
12 |Image label with resource.
17 |Autolink literal after image.
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/fixture/email-tld-digits.html: -------------------------------------------------------------------------------- 1 |a@0.0
2 | 3 |a@a.29
4 | 5 | 6 |react@0.11.1
7 |react@0.12.0-rc1
8 |react@0.14.0-alpha1
9 |react@16.7.0-alpha.2
10 |react@0.0.0-experimental-aae83a4b9
11 |[ react@0.11.1
12 |[ react@0.12.0-rc1
13 |[ react@0.14.0-alpha1
14 |[ react@16.7.0-alpha.2
15 |[ react@0.0.0-experimental-aae83a4b9
16 |react@a
18 |react@1
19 | 20 |react@1.1
21 | 22 | 23 | 24 | 25 |react@1.1-alpha1
26 | 27 |react@1.a-1
28 |[ react@a
30 |[ react@1
31 | 32 |[ react@1.1
33 | 34 | 35 | 36 | 37 |[ react@1.1-alpha1
38 | 39 |[ react@1.a-1
40 | -------------------------------------------------------------------------------- /test/fixture/www-domain-start.html: -------------------------------------------------------------------------------- 1 |www. (space)
3 |www.!
4 |www."
5 | 6 | 7 | 8 | 9 |www.'
10 | 11 |www.)
12 |www.*
13 | 14 |www.,
15 | 16 |www.
17 |www..
18 | 19 |www.:
20 |www.;
21 |www.<
22 | 23 | 24 |www.?
25 | 26 | 27 | 28 |www.]
29 | 30 |www._
31 | 32 | 33 | 34 | 35 |www.~
36 | -------------------------------------------------------------------------------- /test/fixture/http-domain-continue.html: -------------------------------------------------------------------------------- 1 |http://a (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/www-domain-continue.html: -------------------------------------------------------------------------------- 1 |www.a (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/http-path-start.html: -------------------------------------------------------------------------------- 1 |http://a/ (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/www-domain-dot.html: -------------------------------------------------------------------------------- 1 |www.a. (space)
3 |www.a.!
4 |www.a."
5 | 6 | 7 | 8 | 9 |www.a.'
10 | 11 |www.a.)
12 |www.a.*
13 | 14 |www.a.,
15 | 16 | 17 |www.a..
18 | 19 |www.a.:
20 |www.a.;
21 |www.a.<
22 | 23 | 24 |www.a.?
25 | 26 | 27 | 28 |www.a.]
29 | 30 |www.a._
31 | 32 | 33 | 34 | 35 |www.a.~
36 | -------------------------------------------------------------------------------- /test/fixture/www-path-start.html: -------------------------------------------------------------------------------- 1 |www.a/ (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/combined-with-links.md: -------------------------------------------------------------------------------- 1 | Link start. 2 | 3 | [https://a.com 4 | 5 | [http://a.com 6 | 7 | [www.a.com 8 | 9 | [a@b.c 10 | 11 | Label end. 12 | 13 | https://a.com] 14 | 15 | http://a.com] 16 | 17 | www.a.com] 18 | 19 | a@b.c] 20 | 21 | Link start and label end. 22 | 23 | [https://a.com] 24 | 25 | [http://a.com] 26 | 27 | [www.a.com] 28 | 29 | [a@b.c] 30 | 31 | What naïvely seems like a label end (A). 32 | 33 | https://a.com`]` 34 | 35 | http://a.com`]` 36 | 37 | www.a.com`]` 38 | 39 | a@b.c`]` 40 | 41 | Link start and what naïvely seems like a balanced brace (B). 42 | 43 | [https://a.com`]` 44 | 45 | [http://a.com`]` 46 | 47 | [www.a.com`]` 48 | 49 | [a@b.c`]` 50 | 51 | What naïvely seems like a label end (C). 52 | 53 | https://a.com `]` 54 | 55 | http://a.com `]` 56 | 57 | www.a.com `]` 58 | 59 | a@b.c `]` 60 | 61 | Link start and what naïvely seems like a balanced brace (D). 62 | 63 | [https://a.com `]` 64 | 65 | [http://a.com `]` 66 | 67 | [www.a.com `]` 68 | 69 | [a@b.c `]` 70 | 71 | Link label with reference. 72 | 73 | [https://a.com][x] 74 | 75 | [http://a.com][x] 76 | 77 | [www.a.com][x] 78 | 79 | [a@b.c][x] 80 | 81 | [x]: # 82 | 83 | Link label with resource. 84 | 85 | [https://a.com]() 86 | 87 | [http://a.com]() 88 | 89 | [www.a.com]() 90 | 91 | [a@b.c]() 92 | 93 | More in link. 94 | 95 | [a https://b.com c]() 96 | 97 | [a http://b.com c]() 98 | 99 | [a www.b.com c]() 100 | 101 | [a b@c.d e]() 102 | 103 | Autolink literal after link. 104 | 105 | [a]() https://a.com 106 | 107 | [a]() http://a.com 108 | 109 | [a]() www.a.com 110 | 111 | [a]() a@b.c 112 | -------------------------------------------------------------------------------- /test/fixture/http-path-continue.html: -------------------------------------------------------------------------------- 1 |http://a/b (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/previous.md: -------------------------------------------------------------------------------- 1 | # HTTP 2 | 3 | https://a.b can start after EOF 4 | 5 | Can start after EOL: 6 | https://a.b 7 | 8 | Can start after tab: https://a.b. 9 | 10 | Can start after space: https://a.b. 11 | 12 | Can start after left paren (https://a.b. 13 | 14 | Can start after asterisk *https://a.b. 15 | 16 | Can start after underscore *_https://a.b. 17 | 18 | Can start after tilde ~https://a.b. 19 | 20 | # www 21 | 22 | www.a.b can start after EOF 23 | 24 | Can start after EOL: 25 | www.a.b 26 | 27 | Can start after tab: www.a.b. 28 | 29 | Can start after space: www.a.b. 30 | 31 | Can start after left paren (www.a.b. 32 | 33 | Can start after asterisk *www.a.b. 34 | 35 | Can start after underscore *_www.a.b. 36 | 37 | Can start after tilde ~www.a.b. 38 | 39 | # Email 40 | 41 | ## Correct character before 42 | 43 | a@b.c can start after EOF 44 | 45 | Can start after EOL: 46 | a@b.c 47 | 48 | Can start after tab: a@b.c. 49 | 50 | Can start after space: a@b.c. 51 | 52 | Can start after left paren(a@b.c. 53 | 54 | Can start after asterisk*a@b.c. 55 | 56 | While theoretically it’s possible to start at an underscore, that underscore 57 | is part of the email, so it’s in fact part of the link: _a@b.c. 58 | 59 | Can start after tilde~a@b.c. 60 | 61 | ## Others characters before 62 | 63 | While other characters before the email aren’t allowed by GFM, they work on 64 | github.com: !a@b.c, "a@b.c, #a@b.c, $a@b.c, &a@b.c, 'a@b.c, )a@b.c, +a@b.c, 65 | ,a@b.c, -a@b.c, .a@b.c, /a@b.c, :a@b.c, ;a@b.c, a@b.c, ?a@b.c, 66 | @a@b.c, \a@b.c, ]a@b.c, ^a@b.c, `a@b.c, {a@b.c, }a@b.c. 67 | 68 | ## remarkjs/remark#678 69 | 70 | ,https://github.com 71 | 72 | [ ,https://github.com 73 | 74 | [asd] ,https://github.com 75 | -------------------------------------------------------------------------------- /test/fixture/www-path-continue.html: -------------------------------------------------------------------------------- 1 |www.a/b (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/domain-character-reference-like-named.html: -------------------------------------------------------------------------------- 1 |www.a&b (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |www.a&b;
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/algorithm-2.md: -------------------------------------------------------------------------------- 1 | [https:// 2 | 3 | [https://a 4 | 5 | [https://. 6 | 7 | [https://a. 8 | 9 | [https://a.. 10 | 11 | [https://a..b 12 | 13 | [https://a.b 14 | 15 | [https://a.b. 16 | 17 | [https://a.b.. 18 | 19 | [https://a.b.c 20 | 21 | [https://a.b..c 22 | 23 | [https://a.b_.c 24 | 25 | [https://a_.b.c 26 | 27 | [https://a_.b_.c 28 | 29 | [https://a.b© 30 | 31 | [http://點看.com 32 | 33 | --- 34 | 35 | [http://a.b/c (space) 36 | 37 | [http://a.b/c! 38 | 39 | [http://a.b/c" 40 | 41 | [http://a.b/c# 42 | 43 | [http://a.b/c$ 44 | 45 | [http://a.b/c% 46 | 47 | [http://a.b/c& 48 | 49 | [http://a.b/c' 50 | 51 | [http://a.b/c( 52 | 53 | [http://a.b/c) 54 | 55 | [http://a.b/c* 56 | 57 | [http://a.b/c+ 58 | 59 | [http://a.b/c, 60 | 61 | [http://a.b/c- 62 | 63 | [http://a.b/c 64 | 65 | [http://a.b/c. 66 | 67 | [http://a.b/c/ 68 | 69 | [http://a.b/c: 70 | 71 | [http://a.b/c; 72 | 73 | [http://a.b/c< 74 | 75 | [http://a.b/c= 76 | 77 | [http://a.b/c> 78 | 79 | [http://a.b/c? 80 | 81 | [http://a.b/c@ 82 | 83 | [http://a.b/c[ 84 | 85 | [http://a.b/c\ 86 | 87 | [http://a.b/c] 88 | 89 | [http://a.b/c^ 90 | 91 | [http://a.b/c_ 92 | 93 | [http://a.b/c` 94 | 95 | [http://a.b/c{ 96 | 97 | [http://a.b/c| 98 | 99 | [http://a.b/c} 100 | 101 | [http://a.b/c~ 102 | 103 | --- 104 | 105 | [www. 106 | 107 | [www.a 108 | 109 | [www.. 110 | 111 | [www.a. 112 | 113 | [www.a.. 114 | 115 | [www.a..b 116 | 117 | [www.a.b 118 | 119 | [www.a.b. 120 | 121 | [www.a.b.. 122 | 123 | [www.a.b.c 124 | 125 | [www.a.b..c 126 | 127 | [www.a.b_.c 128 | 129 | [www.a_.b.c 130 | 131 | [www.a_.b_.c 132 | 133 | [www.a.b© 134 | 135 | [www.點看.com 136 | 137 | --- 138 | 139 | [a@b.c 140 | 141 | [a@b.ca 142 | 143 | [a@b.c. 144 | 145 | [a@b.ca. 146 | 147 | [a@b.ca.. 148 | 149 | [a@b.ca..b 150 | 151 | [a@b.ca.b 152 | 153 | [a@b.ca.b. 154 | 155 | [a@b.ca.b.. 156 | 157 | [a@b.ca.b.c 158 | 159 | [a@b.ca.b..c 160 | 161 | [a@b.ca.b_.c 162 | 163 | [a@b.ca_.b.c 164 | 165 | [a@b.ca_.b_.c 166 | 167 | [a@b.ca.b© 168 | 169 | [a@b點看.com 170 | 171 | [點看@b.com 172 | -------------------------------------------------------------------------------- /test/fixture/path-character-reference-like-named.html: -------------------------------------------------------------------------------- 1 |www.a/b&c (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |www.a/b&c;
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/domain-character-reference-like-numerical.html: -------------------------------------------------------------------------------- 1 |www.a# (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/path-character-reference-like-numerical.html: -------------------------------------------------------------------------------- 1 |www.a/b# (space)
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/fixture/previous-complex.md: -------------------------------------------------------------------------------- 1 | Last non-markdown ASCII whitespace (FF): noreply@example.com, http://example.com, https://example.com, www.example.com 2 | 3 | Last non-whitespace ASCII control (US): noreply@example.com, http://example.com, https://example.com, www.example.com 4 | 5 | First punctuation after controls: !noreply@example.com, !http://example.com, !https://example.com, !www.example.com 6 | 7 | Last punctuation before digits: /noreply@example.com, /http://example.com, /https://example.com, /www.example.com 8 | 9 | First digit: 0noreply@example.com, 0http://example.com, 0https://example.com, 0www.example.com 10 | 11 | First punctuation after digits: :noreply@example.com, :http://example.com, :https://example.com, :www.example.com 12 | 13 | Last punctuation before caps: @noreply@example.com, @http://example.com, @https://example.com, @www.example.com 14 | 15 | First uppercase: Anoreply@example.com, Ahttp://example.com, Ahttps://example.com, Awww.example.com 16 | 17 | Punctuation after uppercase: \noreply@example.com, \http://example.com, \https://example.com, \www.example.com 18 | 19 | Last punctuation before lowercase (1): `noreply@example.com; 20 | 21 | (2) `http://example.com; 22 | 23 | (3) `https://example.com; 24 | 25 | (4) `www.example.com; (broken up to prevent code from forming) 26 | 27 | First lowercase: anoreply@example.com, ahttp://example.com, ahttps://example.com, awww.example.com 28 | 29 | First punctuation after lowercase: {noreply@example.com, {http://example.com, {https://example.com, {www.example.com 30 | 31 | Last punctuation: ~noreply@example.com, ~http://example.com, ~https://example.com, ~www.example.com 32 | 33 | First non-ASCII unicode whitespace (0x80): noreply@example.com, http://example.com, https://example.com, www.example.com 34 | 35 | Last non-ASCII unicode whitespace (0x3000): noreply@example.com, http://example.com, https://example.com, www.example.com 36 | 37 | First non-ASCII punctuation: ¡noreply@example.com, ¡http://example.com, ¡https://example.com, ¡www.example.com 38 | 39 | Last non-ASCII punctuation: ・noreply@example.com, ・http://example.com, ・https://example.com, ・www.example.com 40 | 41 | Some non-ascii: 中noreply@example.com, 中http://example.com, 中https://example.com, 中www.example.com 42 | 43 | Some more non-ascii: 🤷noreply@example.com, 🤷http://example.com, 🤷https://example.com, 🤷www.example.com 44 | -------------------------------------------------------------------------------- /test/fixture/base.md: -------------------------------------------------------------------------------- 1 | # Literal autolinks 2 | 3 | ## WWW autolinks 4 | 5 | w.commonmark.org 6 | 7 | ww.commonmark.org 8 | 9 | www.commonmark.org 10 | 11 | Www.commonmark.org 12 | 13 | wWw.commonmark.org 14 | 15 | wwW.commonmark.org 16 | 17 | WWW.COMMONMARK.ORG 18 | 19 | Visit www.commonmark.org/help for more information. 20 | 21 | Visit www.commonmark.org. 22 | 23 | Visit www.commonmark.org/a.b. 24 | 25 | www.aaa.bbb.ccc_ccc 26 | 27 | www.aaa_bbb.ccc 28 | 29 | www.aaa.bbb.ccc.ddd_ddd 30 | 31 | www.aaa.bbb.ccc_ccc.ddd 32 | 33 | www.aaa.bbb_bbb.ccc.ddd 34 | 35 | www.aaa_aaa.bbb.ccc.ddd 36 | 37 | Visit www.commonmark.org. 38 | 39 | Visit www.commonmark.org/a.b. 40 | 41 | www.google.com/search?q=Markup+(business) 42 | 43 | www.google.com/search?q=Markup+(business))) 44 | 45 | (www.google.com/search?q=Markup+(business)) 46 | 47 | (www.google.com/search?q=Markup+(business) 48 | 49 | www.google.com/search?q=(business))+ok 50 | 51 | www.google.com/search?q=commonmark&hl=en 52 | 53 | www.google.com/search?q=commonmark&hl;en 54 | 55 | www.google.com/search?q=commonmark&hl; 56 | 57 | www.commonmark.org/he[https://a.com/b).)
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |[https://a.com/(((((b).).).).)
14 |[https://a.com/((((((b).).).).).)
15 | 16 | 17 |[https://a.com/b)..
18 |[https://a.com/b..)
19 | 20 | 21 | 22 |[www.a.com/b))
27 |[www.a.com/b).)
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |[www.a.com/b).
38 |[www.a.com/b.)
39 |[www.a.com/b)..
40 |[www.a.com/b..)
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /test/fixture/combined-with-links.html: -------------------------------------------------------------------------------- 1 |Link start.
2 | 3 | 4 | 5 | 6 |Label end.
7 | 8 | 9 | 10 | 11 |Link start and label end.
12 | 13 | 14 | 15 |[a@b.c]
16 |What naïvely seems like a label end (A).
17 | 18 | 19 | 20 | 21 |Link start and what naïvely seems like a balanced brace (B).
22 | 23 | 24 | 25 |[a@b.c]
What naïvely seems like a label end (C).
27 | 28 | 29 | 30 |a@b.c ]
Link start and what naïvely seems like a balanced brace (D).
32 | 33 |[http://a.com ]
[www.a.com ]
[a@b.c ]
Link label with reference.
37 | 38 | 39 | 40 | 41 |Link label with resource.
42 | 43 | 44 | 45 | 46 |More in link.
47 | 48 | 49 | 50 | 51 |Autolink literal after link.
52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /test/fixture/previous.html: -------------------------------------------------------------------------------- 1 |https://a.b can start after EOF
3 |Can start after EOL: 4 | https://a.b
5 |Can start after tab: https://a.b.
6 |Can start after space: https://a.b.
7 |Can start after left paren (https://a.b.
8 |Can start after asterisk *https://a.b.
9 |Can start after underscore *_https://a.b.
10 |Can start after tilde ~https://a.b.
11 |www.a.b can start after EOF
13 |Can start after EOL: 14 | www.a.b
15 |Can start after tab: www.a.b.
16 |Can start after space: www.a.b.
17 |Can start after left paren (www.a.b.
18 |Can start after asterisk *www.a.b.
19 |Can start after underscore *_www.a.b.
20 |Can start after tilde ~www.a.b.
21 |a@b.c can start after EOF
24 |Can start after EOL: 25 | a@b.c
26 |Can start after tab: a@b.c.
27 |Can start after space: a@b.c.
28 |Can start after left paren(a@b.c.
29 |Can start after asterisk*a@b.c.
30 |While theoretically it’s possible to start at an underscore, that underscore 31 | is part of the email, so it’s in fact part of the link: _a@b.c.
32 |Can start after tilde~a@b.c.
33 |While other characters before the email aren’t allowed by GFM, they work on 35 | github.com: !a@b.c, "a@b.c, #a@b.c, $a@b.c, &a@b.c, 'a@b.c, )a@b.c, +a@b.c, 36 | ,a@b.c, -a@b.c, .a@b.c, /a@b.c, :a@b.c, ;a@b.c, <a@b.c, =a@b.c, >a@b.c, ?a@b.c, 37 | @a@b.c, \a@b.c, ]a@b.c, ^a@b.c, `a@b.c, {a@b.c, }a@b.c.
38 |[asd] ,https://github.com
42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Titus Wormerw.commonmark.org
4 |ww.commonmark.org
5 | 6 | 7 | 8 | 9 | 10 |Visit www.commonmark.org/help for more information.
11 |Visit www.commonmark.org.
12 |Visit www.commonmark.org/a.b.
13 |www.aaa.bbb.ccc_ccc
14 |www.aaa_bbb.ccc
15 |www.aaa.bbb.ccc.ddd_ddd
16 |www.aaa.bbb.ccc_ccc.ddd
17 | 18 | 19 |Visit www.commonmark.org.
20 |Visit www.commonmark.org/a.b.
21 |www.google.com/search?q=Markup+(business)
22 |www.google.com/search?q=Markup+(business)))
23 |(www.google.com/search?q=Markup+(business))
24 |(www.google.com/search?q=Markup+(business)
25 |www.google.com/search?q=(business))+ok
26 |www.google.com/search?q=commonmark&hl=en
27 |www.google.com/search?q=commonmark&hl;en
28 |www.google.com/search?q=commonmark&hl;
29 | 30 |hexample.com
32 |htexample.com
33 |httexample.com
34 |httpexample.com
35 |http:example.com
36 |http:/example.com
37 |https:/example.com
38 | 39 | 40 | 41 | 42 |(Visit https://encrypted.google.com/search?q=Markup+(business))
43 |No dot: foo@barbaz
45 |No dot: foo@barbaz.
46 | 47 |hello@mail+xyz.example isn’t valid, but hello+xyz@mail.example is.
48 | 49 | 50 |a.b-c_d@a.b-
51 |a.b-c_d@a.b_
52 | 53 | 54 |Can’t end in an underscore followed by a period: aaa@a.b_.
55 |Can contain an underscore followed by a period: aaa@a.b_.c
56 |Visit www.example.com please.
58 |Visit http://www.example.com please.
59 |Mail example@example.com please.
60 |link http://autolink should still be expanded.
61 | -------------------------------------------------------------------------------- /test/fixture/algorithm-2.html: -------------------------------------------------------------------------------- 1 |[https://
2 |[https://a
3 |[https://.
4 | 5 |[https://a..
6 | 7 | 8 | 9 |[https://a.b..
10 | 11 | 12 |[https://a.b_.c
13 | 14 |[https://a_.b_.c
15 | 16 |[http://點看.com
17 |[http://a.b/c (space)
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |[www.
54 | 55 |[www..
56 |[www.a.
57 |[www.a..
58 | 59 | 60 |[www.a.b.
61 |[www.a.b..
62 | 63 | 64 |[www.a.b_.c
65 | 66 |[www.a_.b_.c
67 | 68 | 69 |[a@b.c.
73 |[a@b.ca.
74 |[a@b.ca..
75 |[a@b.ca..b
76 | 77 |[a@b.ca.b.
78 |[a@b.ca.b..
79 | 80 |[a@b.ca.b..c
81 | 82 | 83 | 84 |[a@b.ca.b©
85 |[a@b點看.com
86 |[點看@b.com
87 | -------------------------------------------------------------------------------- /test/fixture/previous-complex.html: -------------------------------------------------------------------------------- 1 |Last non-markdown ASCII whitespace (FF): noreply@example.com, http://example.com, https://example.com, www.example.com
2 |Last non-whitespace ASCII control (US): noreply@example.com, http://example.com, https://example.com, www.example.com
3 |First punctuation after controls: !noreply@example.com, !http://example.com, !https://example.com, !www.example.com
4 |Last punctuation before digits: /noreply@example.com, /http://example.com, /https://example.com, /www.example.com
5 |First digit: 0noreply@example.com, 0http://example.com, 0https://example.com, 0www.example.com
6 |First punctuation after digits: :noreply@example.com, :http://example.com, :https://example.com, :www.example.com
7 |Last punctuation before caps: @noreply@example.com, @http://example.com, @https://example.com, @www.example.com
8 |First uppercase: Anoreply@example.com, Ahttp://example.com, Ahttps://example.com, Awww.example.com
9 |Punctuation after uppercase: \noreply@example.com, \http://example.com, \https://example.com, \www.example.com
10 |Last punctuation before lowercase (1): `noreply@example.com;
11 |(2) `http://example.com;
12 |(3) `https://example.com;
13 |(4) `www.example.com; (broken up to prevent code from forming)
14 |First lowercase: anoreply@example.com, ahttp://example.com, ahttps://example.com, awww.example.com
15 |First punctuation after lowercase: {noreply@example.com, {http://example.com, {https://example.com, {www.example.com
16 |Last punctuation: ~noreply@example.com, ~http://example.com, ~https://example.com, ~www.example.com
17 |First non-ASCII unicode whitespace (0x80): noreply@example.com, http://example.com, https://example.com, www.example.com
18 |Last non-ASCII unicode whitespace (0x3000): noreply@example.com, http://example.com, https://example.com, www.example.com
19 |First non-ASCII punctuation: ¡noreply@example.com, ¡http://example.com, ¡https://example.com, ¡www.example.com
20 |Last non-ASCII punctuation: ・noreply@example.com, ・http://example.com, ・https://example.com, ・www.example.com
21 |Some non-ascii: 中noreply@example.com, 中http://example.com, 中https://example.com, 中www.example.com
22 |Some more non-ascii: 🤷noreply@example.com, 🤷http://example.com, 🤷https://example.com, 🤷www.example.com
23 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @import {RegExpMatchObject, ReplaceFunction} from 'mdast-util-find-and-replace' 3 | * @import {CompileContext, Extension as FromMarkdownExtension, Handle as FromMarkdownHandle, Transform as FromMarkdownTransform} from 'mdast-util-from-markdown' 4 | * @import {ConstructName, Options as ToMarkdownExtension} from 'mdast-util-to-markdown' 5 | * @import {Link, PhrasingContent} from 'mdast' 6 | */ 7 | 8 | import {ccount} from 'ccount' 9 | import {ok as assert} from 'devlop' 10 | import {unicodePunctuation, unicodeWhitespace} from 'micromark-util-character' 11 | import {findAndReplace} from 'mdast-util-find-and-replace' 12 | 13 | /** @type {ConstructName} */ 14 | const inConstruct = 'phrasing' 15 | /** @type {Array