Skip to content

Commit 3b9acc5

Browse files
committed
new css style
1 parent 607aa74 commit 3b9acc5

6 files changed

Lines changed: 389 additions & 4 deletions

File tree

DOCUMENTATION.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,3 +888,22 @@ Riscrittura completa del template:
888888
**File**: `data/links.yml`
889889
- Added the IELTS Academic exam (score 7.5) to the "Certificates" section.
890890
- Configured the link to point to `/docs/IELTS.pdf` which should be placed in the `static/docs/` directory.
891+
892+
---
893+
894+
# Professional Markdown Styling for Blog Posts
895+
896+
## Date: 2026-03-30
897+
## Modifications
898+
Implemented a premium, rich styling upgrade for all markdown-rendered elements in blog posts using pure CSS and Vanilla JS.
899+
- **CSS (`assets/css/custom.css`)**: Added `.blog-prose` rule block. Includes:
900+
- Drop cap for the first paragraph.
901+
- Gradient headings with left borders.
902+
- Redesigned blockquotes with quote icons and subtle backgrounds.
903+
- Styled inline code pills and dark-themed code blocks.
904+
- Custom gradient bullets and numbered list markers.
905+
- Alternating colored tables and gradient horizontal rules.
906+
- **Layout (`layouts/blog/single.html`)**: Added the `.blog-prose` class to the main `<article>` tag.
907+
- **JS (`assets/js/main.js`)**:
908+
- Implemented an IntersectionObserver to apply scroll-reveal animations (`.blog-prose-reveal`) to headings, quotes, and images.
909+
- Added logic to generate a "Copy" button (`.copy-code-btn`) for all `<pre>` code blocks.

assets/css/custom.css

Lines changed: 301 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,308 @@ body>div:last-child:empty {
12131213
border-radius: 0.5rem;
12141214
}
12151215

1216-
.content-with-zoom img:hover,
12171216
.content-zoom-img:hover {
12181217
transform: scale(1.015);
12191218
box-shadow: 0 12px 40px rgba(0,0,0,0.18);
12201219
}
1220+
1221+
/* =========================================================
1222+
BLOG PROSE ENHANCEMENTS
1223+
========================================================= */
1224+
1225+
/* 1. Drop Cap for First Paragraph */
1226+
.blog-prose > p:first-of-type::first-letter {
1227+
font-size: 3.5em;
1228+
font-weight: 800;
1229+
float: left;
1230+
line-height: 0.8;
1231+
margin-right: 0.1em;
1232+
margin-top: -0.05em;
1233+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
1234+
-webkit-background-clip: text;
1235+
background-clip: text;
1236+
-webkit-text-fill-color: transparent;
1237+
color: #667eea; /* fallback */
1238+
padding-bottom: 0.1em; /* prevents gradient clipping on some letters */
1239+
}
1240+
1241+
/* 2. Custom Gradient Headings with Left Border */
1242+
.blog-prose h2, .blog-prose h3, .blog-prose h4 {
1243+
position: relative;
1244+
padding-left: 1rem;
1245+
margin-top: 2.5em;
1246+
scroll-margin-top: 6rem; /* for ToC anchors */
1247+
}
1248+
1249+
.blog-prose h2::before, .blog-prose h3::before, .blog-prose h4::before {
1250+
content: "";
1251+
position: absolute;
1252+
left: 0;
1253+
top: 10%;
1254+
bottom: 10%;
1255+
width: 4px;
1256+
background: linear-gradient(to bottom, #667eea, #764ba2);
1257+
border-radius: 4px;
1258+
}
1259+
1260+
/* 3. Redesigned Blockquotes - Pull Quote Style */
1261+
.blog-prose blockquote {
1262+
position: relative;
1263+
padding: 1.5rem 1.5rem 1.5rem 3rem;
1264+
margin: 2.5rem 0;
1265+
border-left: none; /* remove default prose border */
1266+
background: rgba(102, 126, 234, 0.05);
1267+
border-radius: 0 0.5rem 0.5rem 0;
1268+
font-style: italic;
1269+
font-weight: 500;
1270+
color: inherit;
1271+
box-shadow: 0 2px 10px rgba(0,0,0,0.02);
1272+
}
1273+
1274+
.dark .blog-prose blockquote {
1275+
background: rgba(102, 126, 234, 0.08);
1276+
}
1277+
1278+
.blog-prose blockquote::before {
1279+
content: "";
1280+
position: absolute;
1281+
left: 0;
1282+
top: 0;
1283+
bottom: 0;
1284+
width: 4px;
1285+
background: linear-gradient(to bottom, #667eea, #764ba2);
1286+
border-radius: 4px 0 0 4px;
1287+
}
1288+
1289+
/* Add quote icon to blockquote */
1290+
.blog-prose blockquote::after {
1291+
content: "\201C";
1292+
position: absolute;
1293+
left: 1rem;
1294+
top: 0.5rem;
1295+
font-size: 3.5rem;
1296+
font-family: Georgia, serif;
1297+
color: #667eea;
1298+
opacity: 0.25;
1299+
line-height: 1;
1300+
}
1301+
1302+
.blog-prose blockquote p {
1303+
margin: 0 !important; /* Override prose spacing inside blockquote */
1304+
}
1305+
1306+
/* 4. Styled Inline Code Pills */
1307+
.blog-prose p code, .blog-prose li code, .blog-prose a code {
1308+
padding: 0.2em 0.4em;
1309+
background: rgba(102, 126, 234, 0.1);
1310+
color: #667eea;
1311+
border-radius: 0.3em;
1312+
font-size: 0.85em;
1313+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
1314+
word-break: break-word;
1315+
}
1316+
1317+
.dark .blog-prose p code, .dark .blog-prose li code, .dark .blog-prose a code {
1318+
background: rgba(155, 181, 255, 0.15);
1319+
color: #9bb5ff;
1320+
}
1321+
1322+
.blog-prose p code::before, .blog-prose p code::after,
1323+
.blog-prose li code::before, .blog-prose li code::after {
1324+
content: "" !important; /* Remove prose backticks */
1325+
}
1326+
1327+
/* 5. Custom Dark Code Blocks (pre code) */
1328+
.blog-prose pre {
1329+
position: relative;
1330+
background-color: #1e1e2e !important; /* Deep dark tech theme */
1331+
border-radius: 0.75rem;
1332+
border: 1px solid rgba(255, 255, 255, 0.1);
1333+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
1334+
padding: 1.5rem !important;
1335+
margin: 2rem 0;
1336+
overflow-x: auto;
1337+
}
1338+
1339+
.blog-prose pre code {
1340+
color: #cdd6f4 !important; /* Light text for dark bg */
1341+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
1342+
font-size: 0.9em;
1343+
line-height: 1.6;
1344+
background: transparent !important;
1345+
padding: 0;
1346+
}
1347+
1348+
/* Copy Button for Code Blocks */
1349+
.copy-code-btn {
1350+
position: absolute;
1351+
top: 0.5rem;
1352+
right: 0.5rem;
1353+
background: rgba(255, 255, 255, 0.1);
1354+
color: #cdd6f4;
1355+
border: 1px solid rgba(255, 255, 255, 0.2);
1356+
border-radius: 0.4rem;
1357+
padding: 0.3rem 0.6rem;
1358+
font-size: 0.75rem;
1359+
cursor: pointer;
1360+
transition: all 0.2s ease;
1361+
z-index: 10;
1362+
display: flex;
1363+
align-items: center;
1364+
gap: 0.3rem;
1365+
backdrop-filter: blur(4px);
1366+
}
1367+
1368+
.copy-code-btn:hover {
1369+
background: rgba(255, 255, 255, 0.2);
1370+
color: #fff;
1371+
}
1372+
1373+
.copy-code-btn.copied {
1374+
background: rgba(16, 185, 129, 0.2) !important;
1375+
color: #10b981 !important;
1376+
border-color: rgba(16, 185, 129, 0.4) !important;
1377+
}
1378+
1379+
/* 6. Action-Colored Gradient Link Underlines */
1380+
.blog-prose a {
1381+
color: inherit;
1382+
text-decoration: none;
1383+
background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
1384+
background-repeat: no-repeat;
1385+
background-position: bottom left;
1386+
background-size: 100% 2px;
1387+
transition: all 0.3s ease;
1388+
font-weight: 500;
1389+
}
1390+
1391+
.blog-prose a:hover {
1392+
background-size: 100% 100%;
1393+
color: white !important;
1394+
border-radius: 0.15rem;
1395+
padding: 0 0.1rem;
1396+
}
1397+
1398+
/* Don't apply this to linked images */
1399+
.blog-prose a:has(img) {
1400+
background-image: none;
1401+
}
1402+
1403+
/* 7. Custom Bullet List Markers */
1404+
.blog-prose ul {
1405+
list-style: none !important; /* remove default */
1406+
padding-left: 1.5rem;
1407+
}
1408+
1409+
.blog-prose ul > li {
1410+
position: relative;
1411+
padding-left: 0.5rem;
1412+
}
1413+
1414+
.blog-prose ul > li::before {
1415+
content: "";
1416+
position: absolute;
1417+
left: -1rem;
1418+
top: 0.65rem; /* Adjust based on line-height */
1419+
width: 0.4rem;
1420+
height: 0.4rem;
1421+
border-radius: 50%;
1422+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
1423+
box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
1424+
}
1425+
1426+
/* Override prose ol completely */
1427+
.blog-prose ol {
1428+
counter-reset: custom-counter;
1429+
list-style: none !important;
1430+
padding-left: 1.5rem;
1431+
}
1432+
1433+
.blog-prose ol > li {
1434+
position: relative;
1435+
counter-increment: custom-counter;
1436+
padding-left: 0.5rem;
1437+
}
1438+
1439+
.blog-prose ol > li::before {
1440+
content: counter(custom-counter) "." !important;
1441+
position: absolute;
1442+
left: -1.8rem;
1443+
top: 0;
1444+
color: #667eea;
1445+
font-weight: bold;
1446+
font-size: 1em;
1447+
width: 1.5rem;
1448+
text-align: right;
1449+
background: transparent !important;
1450+
}
1451+
1452+
/* 8. Gradient Horizontal Rules (hr) */
1453+
.blog-prose hr {
1454+
border: 0;
1455+
height: 2px;
1456+
background: linear-gradient(to right, transparent, #667eea, #764ba2, transparent);
1457+
margin: 3rem 0;
1458+
opacity: 0.5;
1459+
}
1460+
1461+
/* 9. Styled Tables */
1462+
.blog-prose table {
1463+
width: 100%;
1464+
border-collapse: collapse;
1465+
margin: 2rem 0;
1466+
border-radius: 0.5rem;
1467+
overflow: hidden;
1468+
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
1469+
}
1470+
1471+
.dark .blog-prose table {
1472+
box-shadow: 0 4px 6px rgba(0,0,0,0.3);
1473+
}
1474+
1475+
.blog-prose thead {
1476+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
1477+
color: white;
1478+
}
1479+
1480+
.blog-prose thead th {
1481+
padding: 1rem;
1482+
text-align: left;
1483+
font-weight: 600;
1484+
border: none;
1485+
}
1486+
1487+
.blog-prose tbody tr {
1488+
background: white;
1489+
border-bottom: 1px solid rgba(0,0,0,0.05);
1490+
}
1491+
1492+
.dark .blog-prose tbody tr {
1493+
background: rgba(30, 41, 59, 0.5);
1494+
border-bottom-color: rgba(255,255,255,0.05);
1495+
}
1496+
1497+
.blog-prose tbody tr:nth-child(even) {
1498+
background: rgba(0,0,0,0.02);
1499+
}
1500+
1501+
.dark .blog-prose tbody tr:nth-child(even) {
1502+
background: rgba(255,255,255,0.02);
1503+
}
1504+
1505+
.blog-prose tbody td {
1506+
padding: 1rem;
1507+
}
1508+
1509+
/* Scroll Animation Classes */
1510+
.blog-prose-reveal {
1511+
opacity: 0;
1512+
transform: translateY(20px);
1513+
transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
1514+
will-change: opacity, transform;
1515+
}
1516+
1517+
.blog-prose-reveal.is-visible {
1518+
opacity: 1;
1519+
transform: translateY(0);
1520+
}

0 commit comments

Comments
 (0)