Skip to content

Commit

Permalink
direct download image
Browse files Browse the repository at this point in the history
  • Loading branch information
xqdoo00o authored Oct 13, 2023
1 parent 7a3078f commit 744ee05
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4537,9 +4537,10 @@
md.inline.ruler.after("emphasis", "sub", subscript);
md.use(texmath, { engine: katex, delimiters: "dollars", katexOptions: { macros: { "\\RR": "\\mathbb{R}" } } });
md.renderer.rules.link_open = (tokens, idx, options, env, self) => {
let aIndex = tokens[idx].attrIndex('target');
if (aIndex < 0) tokens[idx].attrPush(['target', '_blank']);
else tokens[idx].attrs[aIndex][1] = '_blank';
let aIndex = tokens[idx].attrIndex("target");
if (tokens[idx + 1] && tokens[idx + 1].type === "image") tokens[idx].attrPush(["download", ""]);
else if (aIndex < 0) tokens[idx].attrPush(["target", "_blank"]);
else tokens[idx].attrs[aIndex][1] = "_blank";
return self.renderToken(tokens, idx, options);
};
const codeUtils = {
Expand Down

0 comments on commit 744ee05

Please sign in to comment.