mirror of
https://github.com/penpot/penpot.git
synced 2025-06-18 21:31:40 +02:00
✨ Allow encode mailto and self target link in markdown
On translation files
This commit is contained in:
parent
e464d8cf9c
commit
de2695682d
2 changed files with 20 additions and 10 deletions
|
@ -237,18 +237,29 @@ async function renderTemplate(path, context = {}, partials = {}) {
|
|||
return mustache.render(content, context, partials);
|
||||
}
|
||||
|
||||
const extension = {
|
||||
useNewRenderer: true,
|
||||
const markedOptions = {
|
||||
renderer: {
|
||||
link(token) {
|
||||
if (token.href === "mailto") {
|
||||
return `<a href="mailto:${token.text}">${token.text}</a>`;
|
||||
} else {
|
||||
let target = "_blank";
|
||||
|
||||
if (token.text.endsWith("|target:self")) {
|
||||
const index = token.text.indexOf("|target:self");
|
||||
token.text = token.text.substring(0, index);
|
||||
target = "_self";
|
||||
}
|
||||
|
||||
const href = token.href;
|
||||
const text = token.text;
|
||||
return `<a href="${href}" target="_blank">${text}</a>`;
|
||||
},
|
||||
},
|
||||
};
|
||||
return `<a href="${href}" target="${target}">${text}</a>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
marked.use(extension);
|
||||
marked.use(markedOptions);
|
||||
|
||||
async function readTranslations() {
|
||||
const langs = [
|
||||
|
|
|
@ -120,7 +120,6 @@ function run-devenv-isolated-shell {
|
|||
$DEVENV_IMGNAME:latest sudo -EH -u penpot bash
|
||||
}
|
||||
|
||||
|
||||
function build {
|
||||
echo ">> build start: $1"
|
||||
local version=$(print-current-version);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue