docs-and-graphs
Advanced tools
Comparing version 0.1.11 to 0.1.12
{ | ||
"name": "docs-and-graphs", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -19,11 +19,14 @@ // [[hello|world]] -> {value:'hello', alias:'world'} | ||
// Matches things like [something](http://example.com) and just http://example.com | ||
const linkRegex = /(?:\[([^\]]+)\]\((https?:\/\/[^\s]+)\))|(https?:\/\/[^\s]+)$/ | ||
function parseExternalLinks (text) { | ||
// @TODO find a lib to do these sort of things. | ||
const matches = text.match(linkRegex) | ||
if (matches) { | ||
return { | ||
alias: matches[1], value: matches[2] || matches[3], | ||
alias: matches[1], value: (matches[2] || matches[3]).replace(/>$/, ''), | ||
} | ||
} | ||
@@ -30,0 +33,0 @@ } |
@@ -26,3 +26,5 @@ export default { | ||
<http://example.com> <https://example2.com> | ||
`, | ||
} |
@@ -23,3 +23,5 @@ import { expect } from 'expect' | ||
'[protocol unknown](hello)', | ||
'[protocol unknown](file://)' | ||
'[protocol unknown](file://)', | ||
'<http://example.org>', | ||
'<https://example.org>' | ||
] | ||
@@ -26,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
265082
5813