diff --git a/build.mjs b/build.mjs
index 5fed98a..ed897f0 100644
--- a/build.mjs
+++ b/build.mjs
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
import { Marked } from 'marked';
-import { docShell, esc, GITHUB_URL, highlightTokens, SITE_URL } from './src/layout.mjs';
+import { docShell, esc, EXT_ATTRS, GITHUB_URL, highlightTokens, SITE_URL } from './src/layout.mjs';
import { renderLanding } from './src/landing.mjs';
import { renderImpressum } from './src/impressum.mjs';
import { renderLicense } from './src/license.mjs';
@@ -128,7 +128,7 @@ const marked = new Marked({
const text = this.parser.parseInline(tokens);
const t = title ? ` title="${esc(title)}"` : '';
const url = rewriteHref(href);
- const ext = /^https?:/.test(url) ? ' rel="external"' : '';
+ const ext = /^https?:/.test(url) ? EXT_ATTRS : '';
return `${text}`;
},
code({ text, lang }) {
diff --git a/src/impressum.mjs b/src/impressum.mjs
index d40d5ee..db812de 100644
--- a/src/impressum.mjs
+++ b/src/impressum.mjs
@@ -1,6 +1,6 @@
// Legal notice (Impressum) - a fully static, hand-written page. Required to be
// reachable from every page under German law (§5 DDG); linked from the footer.
-import { esc, pageShell } from './layout.mjs';
+import { esc, EXT_ATTRS, pageShell } from './layout.mjs';
export function renderImpressum({ version }) {
const body = `
Download dist/flashtrace.mjs into your repository and run it directly.
+Download dist/flashtrace.mjs into your repository and run it directly.
node flashtrace.mjsflashtrace verifies that every requirement in your Markdown specs is covered by the code and tests it demands - with zero runtime dependencies, anywhere Node.js runs.
${ideMock()} diff --git a/src/layout.mjs b/src/layout.mjs index b4937ce..72a790f 100644 --- a/src/layout.mjs +++ b/src/layout.mjs @@ -4,6 +4,10 @@ export const SITE_URL = 'https://flashtrace.github.io'; export const GITHUB_URL = 'https://github.com/flashtrace/flashtrace'; export const DISCUSSIONS_URL = 'https://github.com/flashtrace/flashtrace/discussions'; +// Attributes for links leaving the site: open a new tab. Links that should +// also show the "↗" marker add class="ext-mark" (styled in site.css). +export const EXT_ATTRS = ' target="_blank" rel="external noopener"'; + export function esc(s) { return String(s) .replaceAll('&', '&') @@ -49,13 +53,13 @@ function topBar({ version, active, withSidebar }) {This is not legal advice. Learn more about the Apache License 2.0.
+This is not legal advice. Learn more about the Apache License 2.0.
`; } diff --git a/src/styles/site.css b/src/styles/site.css index c42c66c..ddadce0 100644 --- a/src/styles/site.css +++ b/src/styles/site.css @@ -118,6 +118,14 @@ a:hover { text-decoration: underline; } +/* Opt-in "↗" marker for external links; the arrow-worthy ones add this class + next to EXT_ATTRS (\FE0E forces text over emoji presentation). */ +.ext-mark::after { + content: '\2197\FE0E'; + font-size: 0.75em; + margin-left: 0.15em; +} + img { max-width: 100%; }