mirror of
https://github.com/penpot/penpot.git
synced 2025-06-19 20:11: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);
|
return mustache.render(content, context, partials);
|
||||||
}
|
}
|
||||||
|
|
||||||
const extension = {
|
const markedOptions = {
|
||||||
useNewRenderer: true,
|
|
||||||
renderer: {
|
renderer: {
|
||||||
link(token) {
|
link(token) {
|
||||||
const href = token.href;
|
if (token.href === "mailto") {
|
||||||
const text = token.text;
|
return `<a href="mailto:${token.text}">${token.text}</a>`;
|
||||||
return `<a href="${href}" target="_blank">${text}</a>`;
|
} else {
|
||||||
},
|
let target = "_blank";
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
marked.use(extension);
|
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="${target}">${text}</a>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
marked.use(markedOptions);
|
||||||
|
|
||||||
async function readTranslations() {
|
async function readTranslations() {
|
||||||
const langs = [
|
const langs = [
|
||||||
|
|
|
@ -120,7 +120,6 @@ function run-devenv-isolated-shell {
|
||||||
$DEVENV_IMGNAME:latest sudo -EH -u penpot bash
|
$DEVENV_IMGNAME:latest sudo -EH -u penpot bash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function build {
|
function build {
|
||||||
echo ">> build start: $1"
|
echo ">> build start: $1"
|
||||||
local version=$(print-current-version);
|
local version=$(print-current-version);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue