mirror of
https://github.com/9001/copyparty.git
synced 2026-02-22 10:23:30 +10:00
md: rewrite links to open in viewer; closes #972
This commit is contained in:
@@ -239,6 +239,12 @@ function convert_markdown(md_text, dest_dom) {
|
|||||||
var href = nodes[a].getAttribute('href');
|
var href = nodes[a].getAttribute('href');
|
||||||
var txt = nodes[a].innerHTML;
|
var txt = nodes[a].innerHTML;
|
||||||
|
|
||||||
|
if (/\.[Mm][Dd]$/.test(href)) {
|
||||||
|
var o = new URL(href, location.href).origin;
|
||||||
|
if (!o || o == location.origin)
|
||||||
|
nodes[a].href = href + '?v';
|
||||||
|
}
|
||||||
|
|
||||||
if (!txt)
|
if (!txt)
|
||||||
nodes[a].textContent = href;
|
nodes[a].textContent = href;
|
||||||
else if (href !== txt && !nodes[a].className)
|
else if (href !== txt && !nodes[a].className)
|
||||||
|
|||||||
Reference in New Issue
Block a user