@commonpub/layer 0.38.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,18 +61,7 @@ const isEnded = computed(() => c.value?.status === 'completed' || c.value?.statu
|
|
|
61
61
|
const tagline = computed<string>(() => {
|
|
62
62
|
const sub = (c.value?.subheading ?? '').trim();
|
|
63
63
|
if (sub) return sub;
|
|
64
|
-
|
|
65
|
-
if (!d) return 'No description available.';
|
|
66
|
-
return d
|
|
67
|
-
.replace(/```[\s\S]*?```/g, ' ')
|
|
68
|
-
.replace(/`([^`]*)`/g, '$1')
|
|
69
|
-
.replace(/!\[[^\]]*\]\([^)]*\)/g, ' ')
|
|
70
|
-
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
|
|
71
|
-
.replace(/^#{1,6}\s+/gm, '')
|
|
72
|
-
.replace(/^\s*[-*+>]\s+/gm, '')
|
|
73
|
-
.replace(/(\*\*|__|~~|\*|_)/g, '')
|
|
74
|
-
.replace(/\s+/g, ' ')
|
|
75
|
-
.trim();
|
|
64
|
+
return markdownToExcerpt(c.value?.description) || 'No description available.';
|
|
76
65
|
});
|
|
77
66
|
</script>
|
|
78
67
|
|
|
@@ -27,8 +27,4 @@ defineProps<{
|
|
|
27
27
|
.cpub-sec-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
|
|
28
28
|
|
|
29
29
|
.cpub-rules-card { background: var(--surface); border: var(--border-width-default) solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-md); }
|
|
30
|
-
.cpub-rules-list { padding-left: 20px; margin: 0; }
|
|
31
|
-
.cpub-rule-item { font-size: 12px; color: var(--text-dim); line-height: 1.7; margin-bottom: 6px; }
|
|
32
|
-
.cpub-rule-item:last-child { margin-bottom: 0; }
|
|
33
|
-
.cpub-rules-text { font-size: 12px; color: var(--text-dim); line-height: 1.7; white-space: pre-line; }
|
|
34
30
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonpub/layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"vue": "^3.4.0",
|
|
54
54
|
"vue-router": "^4.3.0",
|
|
55
55
|
"zod": "^4.3.6",
|
|
56
|
-
"@commonpub/config": "0.16.0",
|
|
57
|
-
"@commonpub/docs": "0.6.3",
|
|
58
56
|
"@commonpub/auth": "0.7.0",
|
|
57
|
+
"@commonpub/docs": "0.6.3",
|
|
58
|
+
"@commonpub/config": "0.16.0",
|
|
59
59
|
"@commonpub/editor": "0.7.11",
|
|
60
|
-
"@commonpub/explainer": "0.7.15",
|
|
61
60
|
"@commonpub/learning": "0.5.2",
|
|
62
61
|
"@commonpub/protocol": "0.12.0",
|
|
63
|
-
"@commonpub/
|
|
62
|
+
"@commonpub/explainer": "0.7.15",
|
|
63
|
+
"@commonpub/schema": "0.24.0",
|
|
64
64
|
"@commonpub/ui": "0.9.1",
|
|
65
|
-
"@commonpub/
|
|
65
|
+
"@commonpub/server": "2.67.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@testing-library/jest-dom": "^6.9.1",
|
package/pages/contests/index.vue
CHANGED
|
@@ -9,18 +9,7 @@ const { isAuthenticated, isAdmin, user } = useAuth();
|
|
|
9
9
|
// cards never dump a raw `## ...` wall.
|
|
10
10
|
function cardBlurb(c: { subheading?: string | null; description?: string | null }): string {
|
|
11
11
|
if (c.subheading?.trim()) return c.subheading.trim();
|
|
12
|
-
|
|
13
|
-
if (!d) return '';
|
|
14
|
-
return d
|
|
15
|
-
.replace(/```[\s\S]*?```/g, ' ')
|
|
16
|
-
.replace(/`([^`]*)`/g, '$1')
|
|
17
|
-
.replace(/!\[[^\]]*\]\([^)]*\)/g, ' ')
|
|
18
|
-
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
|
|
19
|
-
.replace(/^#{1,6}\s+/gm, '')
|
|
20
|
-
.replace(/^\s*[-*+>]\s+/gm, '')
|
|
21
|
-
.replace(/(\*\*|__|~~|\*|_)/g, '')
|
|
22
|
-
.replace(/\s+/g, ' ')
|
|
23
|
-
.trim();
|
|
12
|
+
return markdownToExcerpt(c.description);
|
|
24
13
|
}
|
|
25
14
|
|
|
26
15
|
const config = useRuntimeConfig();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip Markdown (and the inline-HTML-ish bits we author) down to clean,
|
|
3
|
+
* single-line plain text suitable for a CSS-clamped excerpt.
|
|
4
|
+
*
|
|
5
|
+
* Used wherever we want a short tagline/blurb from a (possibly long) Markdown
|
|
6
|
+
* description without dumping a raw `## ...` / fenced-code wall into the UI —
|
|
7
|
+
* the contest hero tagline and the contest listing card blurb both share this.
|
|
8
|
+
* The full formatted description still renders through the Markdown pipeline
|
|
9
|
+
* elsewhere; this is purely for the truncated preview.
|
|
10
|
+
*
|
|
11
|
+
* Returns `''` for empty/whitespace input.
|
|
12
|
+
*/
|
|
13
|
+
export function markdownToExcerpt(raw: string | null | undefined): string {
|
|
14
|
+
const d = (raw ?? '').trim();
|
|
15
|
+
if (!d) return '';
|
|
16
|
+
return d
|
|
17
|
+
.replace(/```[\s\S]*?```/g, ' ')
|
|
18
|
+
.replace(/`([^`]*)`/g, '$1')
|
|
19
|
+
.replace(/!\[[^\]]*\]\([^)]*\)/g, ' ')
|
|
20
|
+
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
|
|
21
|
+
.replace(/^#{1,6}\s+/gm, '')
|
|
22
|
+
.replace(/^\s*[-*+>]\s+/gm, '')
|
|
23
|
+
.replace(/(\*\*|__|~~|\*|_)/g, '')
|
|
24
|
+
.replace(/\s+/g, ' ')
|
|
25
|
+
.trim();
|
|
26
|
+
}
|