mirror of
https://github.com/9001/copyparty.git
synced 2026-01-12 15:52:39 -07:00
md: rewrite links to open in viewer; closes #972
This commit is contained in:
parent
04ac7fbd21
commit
278a0d8548
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue