[feature] Parse content warning as HTML, serialize via API to plaintext

This commit is contained in:
tobi 2025-03-06 15:36:58 +01:00
commit 22ce924129
47 changed files with 947 additions and 553 deletions

View file

@ -141,6 +141,52 @@ main {
}
}
.text > .content,
.text-spoiler > summary > .spoiler-content {
word-break: break-word;
line-height: 1.6rem;
width: 100%;
a {
color: $link-fg;
text-decoration: underline;
}
/*
Normalize header sizes to fit better
with the line-height we use for statuses.
*/
h1 {
margin: 0;
font-size: 1.8rem;
line-height: initial;
}
h2 {
margin: 0;
font-size: 1.6rem;
line-height: initial;
}
h3 {
margin: 0;
font-size: 1.4rem;
line-height: initial;
}
h4 {
margin: 0;
font-size: 1.2rem;
line-height: initial;
}
h5 {
margin: 0;
font-size: 1rem;
line-height: initial;
}
}
.text {
margin: 0;
grid-row: span 1;
@ -152,51 +198,6 @@ main {
width: 100%;
a {
color: $link-fg;
text-decoration: underline;
}
.content {
word-break: break-word;
line-height: 1.6rem;
width: 100%;
/*
Normalize header sizes to fit better
with the line-height we use for statuses.
*/
h1 {
margin: 0;
font-size: 1.8rem;
line-height: initial;
}
h2 {
margin: 0;
font-size: 1.6rem;
line-height: initial;
}
h3 {
margin: 0;
font-size: 1.4rem;
line-height: initial;
}
h4 {
margin: 0;
font-size: 1.2rem;
line-height: initial;
}
h5 {
margin: 0;
font-size: 1rem;
line-height: initial;
}
}
.poll {
background-color: $gray2;
z-index: 2;

View file

@ -126,15 +126,15 @@ function StatusBody({ status }: { status: StatusType }) {
<div className="status-body">
<details className="text-spoiler">
<summary>
<span
className="spoiler-text"
<div
className="spoiler-content"
lang={status.language}
>
{ status.spoiler_text
? status.spoiler_text + " "
: "[no content warning set] "
}
</span>
</div>
<span
className="button"
role="button"

View file

@ -38,7 +38,9 @@
{{- if .SpoilerText }}
<details class="text-spoiler">
<summary>
<span class="spoiler-text p-summary" lang="{{- .LanguageTag.TagStr -}}">{{- emojify .Emojis (escape .SpoilerText) -}}</span>
<div class="spoiler-content p-summary" lang="{{- .LanguageTag.TagStr -}}">
{{ noescape .SpoilerContent | emojify .Emojis }}
</div>
<span class="button" role="button" tabindex="0">Toggle visibility</span>
</summary>
<div class="text">