mirror of
https://github.com/9001/copyparty.git
synced 2025-12-08 06:03:29 -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 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)
|
||||
nodes[a].textContent = href;
|
||||
else if (href !== txt && !nodes[a].className)
|
||||
|
|
|
|||
Loading…
Reference in a new issue