|
|
@@ -70,17 +70,17 @@ export default class Linker {
|
|
|
({ label } = str.match(this.patterns.pukiwikiLinkWithoutLabel).groups);
|
|
|
link = label;
|
|
|
}
|
|
|
+ // markdown
|
|
|
+ else if (str.match(this.patterns.markdownLink)) {
|
|
|
+ type = this.types.markdownLink;
|
|
|
+ ({ label, link } = str.match(this.patterns.markdownLink).groups);
|
|
|
+ }
|
|
|
// growi
|
|
|
else if (str.match(this.patterns.growiLink)) {
|
|
|
type = this.types.growiLink;
|
|
|
({ label } = str.match(this.patterns.growiLink).groups);
|
|
|
link = label;
|
|
|
}
|
|
|
- // markdown
|
|
|
- else if (str.match(this.patterns.markdownLink)) {
|
|
|
- type = this.types.markdownLink;
|
|
|
- ({ label, link } = str.match(this.patterns.markdownLink).groups);
|
|
|
- }
|
|
|
|
|
|
const isUsePermanentLink = false;
|
|
|
const permalink = '';
|
|
|
@@ -114,19 +114,16 @@ export default class Linker {
|
|
|
// pukiwiki link ('[[link]]')
|
|
|
[beginningOfLink, endOfLink] = this.getBeginningAndEndIndexWithPrefixAndSuffix(line, index, '[[', ']]');
|
|
|
|
|
|
- // if index is not in a pukiwiki link
|
|
|
- // growi link ('[/link]')
|
|
|
+ // markdown link ('[label](link)')
|
|
|
if (beginningOfLink < 0 || endOfLink < 0 || beginningOfLink > index || endOfLink < index) {
|
|
|
- [beginningOfLink, endOfLink] = this.getBeginningAndEndIndexWithPrefixAndSuffix(line, index, '[/', ']');
|
|
|
+ [beginningOfLink, endOfLink] = this.getBeginningAndEndIndexWithPrefixAndSuffix(line, index, '[', ')', '](');
|
|
|
}
|
|
|
|
|
|
- // and if index is not in a growi link
|
|
|
- // markdown link ('[label](link)')
|
|
|
+ // growi link ('[/link]')
|
|
|
if (beginningOfLink < 0 || endOfLink < 0 || beginningOfLink > index || endOfLink < index) {
|
|
|
- [beginningOfLink, endOfLink] = this.getBeginningAndEndIndexWithPrefixAndSuffix(line, index, '[', ')', '](');
|
|
|
+ [beginningOfLink, endOfLink] = this.getBeginningAndEndIndexWithPrefixAndSuffix(line, index, '[/', ']');
|
|
|
}
|
|
|
|
|
|
- // and if index is not in a markdown link
|
|
|
// return { beginningOfLink: -1, endOfLink: -1 }
|
|
|
if (beginningOfLink < 0 || endOfLink < 0 || beginningOfLink > index || endOfLink < index) {
|
|
|
[beginningOfLink, endOfLink] = [-1, -1];
|