Closed dank8 closed 7 months ago
escaping reserved characters appears to be coded but not yet released. Cant find the issue number.
My other suggestion to add the hostname at the end of the link title. Here is modified version of function Markdown.linkTo()
demonstrating an option (free for use):
function linkTo(title, url) {
let titleToUse;
if (title === '') {
titleToUse = this.constructor.DefaultTitle();
} else {
var hostName = '';
try{ hostName = ' (' + url.split(/[\/\\]+/g)[1].replace(/^www\./g,'') + ')';
} catch {}
titleToUse = title + hostName;//this.escapeLinkText(title + hostName );
}
return `[${titleToUse}](${url})`;
}
//some simple assertions
var result;
result = linkTo('hello world [1] all', 'https://helloworld.com/hellomonkey') === '[hello world [1] all (helloworld.com)](https://helloworld.com/hellomonkey)';
console.log( result );
result = linkTo('hello world [2] all', 'https://www.helloworld.com/hellomonkey') === '[hello world [2] all (helloworld.com)](https://www.helloworld.com/hellomonkey)';
console.log( result );
result = linkTo('hello world [3] all', 'file:///tmp/basic.htm') === '[hello world [3] all (tmp)](file:///tmp/basic.htm)';
console.log( result );
Sorry, just noticed this issue post. Most Markdown processors handle nested []
s correctly. If your processor does not handle it properly, please turn on "always escape" in the Options page of Copy as Markdown (under Advanced section), so that it will always escape brackets in the link title. Let me know if you still run into this trouble when using this option. Thanks!
Summary
Tiles with brackets currently break the markdown coded link. Please sanitize the Title text to remove square brackets.
Reproduction Steps
Tested with the following options:
Expected Behavior
generated text is a valid markdown link
Optional request: can the hostname be added to the link title. example:
Actual Behavior
generated link text includes square brackets, breaking the markdown link format
Reproducible Environment