Merge pull request #472 from JeffreyCA/jeffreyca/mailto-fix
Prevent mailto links from being joined with prefix
This commit is contained in:
commit
638e34f818
6 changed files with 10 additions and 1 deletions
|
@ -390,7 +390,11 @@ export class MarkdownProcessor extends BaseProcessor {
|
|||
}
|
||||
|
||||
const markdownPathRegex = /(!?)\[([^\]\[]*|!\[[^\]\[]*]\([^\)]+\))\]\(([^\)]+)\)/g;
|
||||
const urlReplace = (_, isImage, title, link) => {
|
||||
const urlReplace = (_, isImage, title, link: string) => {
|
||||
if (/^mailto:/i.test(link)) {
|
||||
return `${isImage}[${title}](${link})`;
|
||||
}
|
||||
|
||||
const isLinkRelative = !/^\w+:\/\//.test(link) && link[0] !== '#';
|
||||
|
||||
if (!this.baseContentUrl && !this.baseImagesUrl) {
|
||||
|
|
1
src/test/fixtures/readme/readme.expected.md
vendored
1
src/test/fixtures/readme/readme.expected.md
vendored
|
@ -31,6 +31,7 @@ The `spellMD.json` config file is watched so you can add more ignores or change
|
|||
|
||||
[mono](https://github.com/username/repository/blob/master/monkey)
|
||||
[not](http://shouldnottouchthis/)
|
||||
[Email me](mailto:example@example.com)
|
||||
|
||||
# Install
|
||||
This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
|
||||
|
|
|
@ -12,3 +12,4 @@
|
|||
* foo/$234/#7
|
||||
* [#7](http://shouldnottouchthis/)
|
||||
* [other/repositoryName#8](http://shouldnottouchthis/)
|
||||
* [Email me](MAILTO:example@example.com)
|
||||
|
|
1
src/test/fixtures/readme/readme.github.md
vendored
1
src/test/fixtures/readme/readme.github.md
vendored
|
@ -12,3 +12,4 @@
|
|||
* foo/$234/#7
|
||||
* [#7](http://shouldnottouchthis/)
|
||||
* [other/repositoryName#8](http://shouldnottouchthis/)
|
||||
* [Email me](MAILTO:example@example.com)
|
||||
|
|
|
@ -31,6 +31,7 @@ The `spellMD.json` config file is watched so you can add more ignores or change
|
|||
|
||||
[mono](https://github.com/username/repository/blob/master/monkey)
|
||||
[not](http://shouldnottouchthis/)
|
||||
[Email me](mailto:example@example.com)
|
||||
|
||||
# Install
|
||||
This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
|
||||
|
|
1
src/test/fixtures/readme/readme.md
vendored
1
src/test/fixtures/readme/readme.md
vendored
|
@ -31,6 +31,7 @@ The `spellMD.json` config file is watched so you can add more ignores or change
|
|||
|
||||
[mono](monkey)
|
||||
[not](http://shouldnottouchthis/)
|
||||
[Email me](mailto:example@example.com)
|
||||
|
||||
# Install
|
||||
This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
|
||||
|
|
Loading…
Add table
Reference in a new issue