mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
Change titles to font-weight semibold
This commit is contained in:
@@ -3,13 +3,19 @@
|
||||
|
||||
import markdown from "@app/lib/markdown";
|
||||
import { twemoji } from "@app/lib/utils";
|
||||
import { Renderer } from "@app/lib/markdown";
|
||||
|
||||
export let content: string;
|
||||
export let stripEmphasizedStyling: boolean = false;
|
||||
export let fontSize: "tiny" | "small" | "regular" | "medium" | "large" =
|
||||
"small";
|
||||
|
||||
const render = (content: string): string =>
|
||||
dompurify.sanitize(markdown.parseInline(content) as string);
|
||||
dompurify.sanitize(
|
||||
markdown.parseInline(content, {
|
||||
renderer: new Renderer(undefined, stripEmphasizedStyling),
|
||||
}) as string,
|
||||
);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
function render(content: string): string {
|
||||
return dompurify.sanitize(
|
||||
markdown.parse(content, {
|
||||
renderer: new Renderer(linkBaseUrl),
|
||||
renderer: new Renderer(linkBaseUrl, false),
|
||||
}) as string,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,9 +83,7 @@
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
.name {
|
||||
white-space: nowrap;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
.rid {
|
||||
visibility: hidden;
|
||||
@@ -107,7 +105,7 @@
|
||||
<div class="left">
|
||||
<div class="text">
|
||||
<div class="title">
|
||||
<span class="name" title={name}>
|
||||
<span class="name txt-overflow" title={name}>
|
||||
{name}
|
||||
</span>
|
||||
{#if visibility === "private"}
|
||||
|
||||
+11
-1
@@ -102,14 +102,16 @@ const anchorMarkedExtension = {
|
||||
|
||||
export class Renderer extends BaseRenderer {
|
||||
#baseUrl: string | undefined;
|
||||
#stripEmphasizedStyling: boolean | undefined;
|
||||
|
||||
/**
|
||||
* If `baseUrl` is provided, all hrefs attributes in anchor tags, except those
|
||||
* starting with `#`, are resolved with respect to `baseUrl`
|
||||
*/
|
||||
constructor(baseUrl: string | undefined) {
|
||||
constructor(baseUrl: string | undefined, stripEmphasizedStyling: boolean) {
|
||||
super();
|
||||
this.#baseUrl = baseUrl;
|
||||
this.#stripEmphasizedStyling = stripEmphasizedStyling;
|
||||
}
|
||||
// Overwrites the rendering of heading tokens.
|
||||
// Since there are possible non ASCII characters in headings,
|
||||
@@ -125,6 +127,14 @@ export class Renderer extends BaseRenderer {
|
||||
return `<h${level} id="${escapedText}">${text}</h${level}>`;
|
||||
}
|
||||
|
||||
strong(text: string) {
|
||||
return this.#stripEmphasizedStyling ? text : `<strong>${text}</strong>`;
|
||||
}
|
||||
|
||||
em(text: string) {
|
||||
return this.#stripEmphasizedStyling ? text : `<em>${text}</em>`;
|
||||
}
|
||||
|
||||
link(href: string, _title: string, text: string): string {
|
||||
if (href.startsWith("#")) {
|
||||
// By lowercasing we avoid casing mismatches, between headings and links.
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
margin-bottom: 3rem;
|
||||
border-radius: var(--border-radius-small);
|
||||
}
|
||||
.title {
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
.description {
|
||||
font-family: var(--font-family-monospace);
|
||||
margin: 1rem 0;
|
||||
@@ -33,7 +36,12 @@
|
||||
<Layout {baseUrl} {project}>
|
||||
<div class="commit">
|
||||
<div class="header">
|
||||
<InlineMarkdown fontSize="large" content={header.summary} />
|
||||
<span class="title">
|
||||
<InlineMarkdown
|
||||
stripEmphasizedStyling
|
||||
fontSize="large"
|
||||
content={header.summary} />
|
||||
</span>
|
||||
<pre class="description txt-small">{header.description}</pre>
|
||||
<CommitAuthorship {header}>
|
||||
<span class="global-commit">{formatCommit(header.id)}</span>
|
||||
|
||||
@@ -453,6 +453,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: var(--font-weight-semibold);
|
||||
font-size: var(--font-size-large);
|
||||
height: 2.5rem;
|
||||
}
|
||||
@@ -484,7 +485,10 @@
|
||||
<span class="txt-missing">No title</span>
|
||||
{:else}
|
||||
<div class="title">
|
||||
<InlineMarkdown fontSize="large" content={issue.title} />
|
||||
<InlineMarkdown
|
||||
stripEmphasizedStyling
|
||||
fontSize="large"
|
||||
content={issue.title} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, project.delegates, issue.author.id) && issueState === "read"}
|
||||
|
||||
@@ -141,7 +141,10 @@
|
||||
bind:value={issueTitle}
|
||||
showKeyHint={false} />
|
||||
{:else if issueTitle}
|
||||
<InlineMarkdown fontSize="medium" content={issueTitle} />
|
||||
<InlineMarkdown
|
||||
stripEmphasizedStyling
|
||||
fontSize="medium"
|
||||
content={issueTitle} />
|
||||
{:else}
|
||||
<span class="txt-missing">No title</span>
|
||||
{/if}
|
||||
|
||||
@@ -585,6 +585,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: var(--font-weight-semibold);
|
||||
font-size: var(--font-size-large);
|
||||
height: 2.5rem;
|
||||
}
|
||||
@@ -669,7 +670,10 @@
|
||||
<span class="txt-missing">No title</span>
|
||||
{:else}
|
||||
<div class="title">
|
||||
<InlineMarkdown fontSize="large" content={patch.title} />
|
||||
<InlineMarkdown
|
||||
stripEmphasizedStyling
|
||||
fontSize="large"
|
||||
content={patch.title} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, project.delegates, patch.author.id) && patchState === "read"}
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
.description {
|
||||
padding: 0 1rem 1rem 1rem;
|
||||
}
|
||||
.project-name {
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
.project-name:hover {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user