diff --git a/public/og/from-chars-formats-table.png b/public/og/from-chars-formats-table.png new file mode 100644 index 00000000..9a2f4532 Binary files /dev/null and b/public/og/from-chars-formats-table.png differ diff --git a/social/facebook/from-chars-formats-table/README.md b/social/facebook/from-chars-formats-table/README.md new file mode 100644 index 00000000..85dc2af2 --- /dev/null +++ b/social/facebook/from-chars-formats-table/README.md @@ -0,0 +1,130 @@ +# LinkedIn Square Post (1200x1200) + +Standard LinkedIn feed post at 1:1 square aspect ratio. Works well as a scroll-stopping image in the LinkedIn feed. + +## Usage + +```bash +brand-gen init social/linkedin-post my-post +cd my-post +# edit content.md +brand-gen build # -> index.html +brand-gen image # -> my-post.png (2400x2400 at 2x DPR) +``` + +## Directives + +All templates use one of four post types. Each uses the same directive pattern: + +### Quote + +```markdown +::::post{type=quote theme=dark logo=top-left} + +:::quote{author="Filip Sajdak" role="Founder & CEO, ScudoAI"} + +Sovereign AI is not a feature you bolt on later. It is the architecture. + +::: + +:::: +``` + +### Stat + +```markdown +::::post{type=stat theme=light accent=brand} + +:::stat{value="USD 80B" label="Worldwide sovereign cloud spend" context="Europe is the fastest-growing region at 83% YoY." source="Gartner, Feb 2026"} +::: + +:::: +``` + +### Announcement + +```markdown +::::post{type=announcement theme=light} + +:::announcement{kind="launch" date="April 2026"} + +# ScudoAI joins NVIDIA Inception + +We are thrilled to join the NVIDIA Inception program to accelerate sovereign AI deployment across European regulated industries. + +::: + +:::: +``` + +### Insight + +```markdown +::::post{type=insight theme=dark} + +:::insight{citation="EU AI Act full enforcement: 2 August 2026"} + +# The AI compliance deadline most companies are missing + +Full EU AI Act enforcement for high-risk AI systems begins in 2 August 2026. Most regulated enterprises are not ready for the documentation and audit requirements. Teams running cloud AI will face the hardest transition. + +::: + +:::: +``` + +## Attributes reference + +### `::::post` attributes + +- `type` - quote | stat | announcement | insight (required) +- `theme` - dark | light (default light) +- `accent` - brand | amber | nv (optional colored gradient background) +- `logo` - top-left | top-right | bottom-left | bottom-right (default bottom-right) + +### `:::quote` attributes + +- `author` - attribution name (appears below the quote) +- `role` - attribution role/title (appears under the author) + +### `:::stat` attributes + +- `value` - the big number (e.g. "USD 80B", "3/4", "Hours to minutes") +- `label` - short label under the value +- `context` - 1-2 sentences providing context +- `source` - small citation + +### `:::announcement` attributes + +- `kind` - launch | milestone | event | hire | partnership +- `date` - free-form date string + +### `:::insight` attributes + +- `citation` - small footer citation (e.g. regulation reference) + +## Character limits + +- **Quote body**: ~120 characters for maximum readability at thumbnail size +- **Stat label**: ~40 characters +- **Stat context**: ~200 characters +- **Announcement headline**: ~80 characters +- **Announcement body**: ~250 characters +- **Insight hook**: ~100 characters +- **Insight body**: ~300 characters + +Posts that exceed these limits will still render but typography may shrink or content may clip. + +## Media + +Add a `media/` directory to the project and reference local files: + +```markdown +:::background{image="nvidia-thor.jpg" overlay="dark"} +::: + +:::image{src="product-screenshot.png" alt="ScudoAI compliance dashboard" position="top"} +::: +``` + +Paths are relative to the project's `media/` directory. diff --git a/social/facebook/from-chars-formats-table/assets/brand-kit.json b/social/facebook/from-chars-formats-table/assets/brand-kit.json new file mode 100644 index 00000000..c2c4e317 --- /dev/null +++ b/social/facebook/from-chars-formats-table/assets/brand-kit.json @@ -0,0 +1,11 @@ +{ + "template": "social/linkedin-post", + "bundleSource": "scudoai-social.css", + "brandKitVersion": "0.1.0", + "vendoredAt": "2026-11-17T23:49:57.369Z", + "files": [ + "scudoai.css", + "layout.css", + "logo-symbol.svg" + ] +} diff --git a/social/facebook/from-chars-formats-table/assets/layout.css b/social/facebook/from-chars-formats-table/assets/layout.css new file mode 100644 index 00000000..e69de29b diff --git a/social/facebook/from-chars-formats-table/assets/logo-symbol.svg b/social/facebook/from-chars-formats-table/assets/logo-symbol.svg new file mode 100644 index 00000000..1fc44966 --- /dev/null +++ b/social/facebook/from-chars-formats-table/assets/logo-symbol.svg @@ -0,0 +1,22 @@ + diff --git a/social/facebook/from-chars-formats-table/assets/scudoai.css b/social/facebook/from-chars-formats-table/assets/scudoai.css new file mode 100644 index 00000000..612b5a12 --- /dev/null +++ b/social/facebook/from-chars-formats-table/assets/scudoai.css @@ -0,0 +1,343 @@ +/* ============================================================ + * wro.cpp social card -- standalone stylesheet + * + * Self-contained styling for brand-gen's `social/linkedin-post` + * output. Replaces (does NOT extend) the scudoai-social.css that + * brand-gen ships with -- the design language here is the + * wro.cpp 'Editorial Magnet' look used by src/styles/global.css, + * not the scudoai blue-indigo deck aesthetic. + * + * Source of truth for tokens: src/styles/global.css:12-30 in the + * wrocpp.github.io repo. + * + * Brand-gen markup we style: + *
+ *
(decorative, hidden) + *
(decorative, hidden) + *
+ *

...

+ *

...

+ *
...
+ *
+ *
+ * + * ScudoAI (hidden; replaced via ::after) + *
+ *
+ * + * Other card types (card-quote, card-stat, card-announcement) + * get analogous rules at the bottom. + * ============================================================ */ + +@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=JetBrains+Mono:wght@400;500;700&display=swap'); + +:root { + --paper: #FCFAF5; + --paper-2: #F3EFE6; + --paper-3: #E8E1D0; + --ink: #1B1B1D; + --ink-muted:#55555A; + --ink-faint:#8A8A90; + --rule: #D7D2C4; + --orange: #EA541E; + --orange-2: #D6481A; + --blue: #3EB5E9; + --blue-deep:#2E8FB8; + + --font-display: 'Quicksand', system-ui, -apple-system, sans-serif; + --font-body: 'Source Serif 4', Georgia, serif; + --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; +} + +html, body { + margin: 0; + padding: 0; + background: var(--paper); + color: var(--ink); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-family: var(--font-body); + font-size: 18px; + line-height: 1.6; +} + +/* Hide brand-gen decorative noise -- the wro.cpp aesthetic is calm + * and editorial, not a dark deck with glow + grid backgrounds. */ +.grid-bg, .glow { display: none !important; } + +/* ---------------- Card frame (1200x1200) ---------------- */ +.card { + position: relative; + width: 1200px; + height: 1200px; + background: var(--paper); + /* Faint warm radial wash, mirrors body { background-image } in + * src/styles/global.css:44-49 -- gives the paper texture without + * looking flat. */ + background-image: + radial-gradient(900px 700px at 80% -10%, rgba(234, 84, 30, 0.06), transparent 60%), + radial-gradient(800px 600px at -10% 110%, rgba(62, 181, 233, 0.05), transparent 60%); + overflow: hidden; + box-sizing: border-box; + padding: 130px 110px 130px 110px; + display: flex; + flex-direction: column; + /* Faint inner border gives the card a printed-page feel. */ + border-bottom: 6px solid var(--orange); +} + +/* Override: theme=dark cards still use paper. We keep the editorial + * light look across the board so the wro.cpp brand stays consistent. + * If the user really wants a dark variant later, this is the hook. */ +.card.dark { background: var(--paper) !important; color: var(--ink) !important; } +.card.dark h1, .card.dark h2, .card.dark p, +.card.dark blockquote { color: var(--ink) !important; } + +/* ---------------- INSIGHT card ---------------- */ +.card-insight { + justify-content: center; + padding-top: 200px; /* reserve space for logo watermark (top:90px + 64px + safety) */ +} +.card-insight .insight-content { + display: flex; + flex-direction: column; + gap: 60px; + max-width: 980px; +} +.card-insight h1 { + font-family: var(--font-display); + font-weight: 700; + font-size: 92pt; + line-height: 1.02; + letter-spacing: -0.025em; + color: var(--ink); + margin: 0; +} +.card-insight h1.title-long { + font-size: 72pt; + line-height: 1.06; + letter-spacing: -0.02em; + max-height: 420px; +} +.card-insight h1.title-xlong { + font-size: 56pt; + line-height: 1.10; + letter-spacing: -0.015em; + max-height: 440px; +} +/* Auto-accent: ++ in C++/C++26 turns orange, sentence-final period + * (when wrapped in ) turns blue. The skill writes + * the heading with these spans for the wro.cpp signature look. */ +.card-insight h1 .accent { color: var(--orange); } +.card-insight h1 .dot { color: var(--blue-deep); } +.card-insight p { + font-family: var(--font-body); + font-size: 30pt; + line-height: 1.5; + color: var(--ink-muted); + margin: 0; + max-width: 920px; +} +.card-insight .insight-citation { + font-family: var(--font-mono); + font-size: 18pt; + letter-spacing: 0.04em; + color: var(--ink-faint); + margin-top: 40px; + padding-top: 30px; + border-top: 1px solid var(--rule); + text-transform: lowercase; +} +.card-insight .insight-citation::before { + content: '// '; + color: var(--orange); + font-weight: 700; +} + +/* ---------------- QUOTE card ---------------- */ +.card-quote { justify-content: center; padding: 140px 110px; } +.card-quote .quote-content { display: flex; flex-direction: column; align-items: flex-start; } +.card-quote .quote-mark { + font-family: var(--font-display); + font-weight: 700; + font-size: 200pt; + line-height: 0.8; + color: var(--orange); + opacity: 0.20; + /* In-flow above the text (not floated in the corner) with a negative + * bottom margin so the mark nearly touches the first quote line. */ + margin: 0 0 -0.62em; +} +.card-quote .quote-body { + font-family: var(--font-display); + font-weight: 600; + font-size: 64pt; + line-height: 1.15; + letter-spacing: -0.02em; + color: var(--ink); + max-width: 980px; + margin: 0; +} +.card-quote .quote-attribution { + margin-top: 50px; + font-family: var(--font-mono); + font-size: 18pt; + color: var(--ink-muted); +} +.card-quote .quote-attribution::before { content: '-- '; color: var(--orange); } +/* author and role are adjacent spans with no separator in the markup; + * add one so they do not run together ("wro.cppC++26 ..."). */ +.card-quote .quote-attribution .role::before { content: ' / '; color: var(--ink-faint); } + +/* ---------------- STAT card ---------------- */ +.card-stat { justify-content: center; } +/* Value and label sit side by side (label wraps to stacked lines whose + * combined height roughly matches the value); context + source span the + * full width underneath. */ +.card-stat .stat-content { + display: grid; + grid-template-columns: auto 1fr; + grid-template-areas: + "value label" + "context context" + "source source"; + column-gap: 64px; + align-items: center; +} +.card-stat .stat-value { + grid-area: value; + font-family: var(--font-display); + font-weight: 700; + font-size: 240pt; + line-height: 0.82; + letter-spacing: -0.04em; + color: var(--orange); + margin: 0; +} +.card-stat .stat-label { + grid-area: label; + font-family: var(--font-display); + font-weight: 700; + font-size: 90pt; + line-height: 1.0; + letter-spacing: -0.02em; + color: var(--ink); + /* min-content forces a per-word wrap, so "codegen steps" stacks into + * two lines next to the value instead of running on one long line. */ + width: min-content; + margin: 0; +} +.card-stat .stat-context { + grid-area: context; + font-family: var(--font-body); + font-size: 26pt; + line-height: 1.45; + color: var(--ink-muted); + margin: 56px 0 0; + max-width: 880px; +} +.card-stat .stat-source { + grid-area: source; + margin-top: 44px; + font-family: var(--font-mono); + font-size: 18pt; + color: var(--ink-faint); +} +.card-stat .stat-source::before { content: '// '; color: var(--orange); } + +/* ---------------- ANNOUNCEMENT card ---------------- */ +.card-announcement { justify-content: center; } +.card-announcement .announcement-meta { + font-family: var(--font-mono); + font-size: 20pt; + text-transform: uppercase; + letter-spacing: 0.08em; + color: var(--orange); + margin-bottom: 30px; +} +.card-announcement .announcement-content h1, +.card-announcement .announcement-content h2 { + font-family: var(--font-display); + font-weight: 700; + font-size: 78pt; + line-height: 1.05; + letter-spacing: -0.02em; + color: var(--ink); + margin: 0; +} +.card-announcement .announcement-content p { + font-family: var(--font-body); + font-size: 28pt; + line-height: 1.5; + color: var(--ink-muted); + margin: 40px 0 0; + max-width: 900px; +} + +/* ---------------- LOGO WATERMARK ---------------- */ +/* brand-gen hard-codes "ScudoAI" in .logo-wordmark; we hide it and + * draw "wro.cpp" via ::after on the watermark. The orange ".cpp" mirrors + * the brand-mark in the site header. */ +.logo-watermark { + position: absolute; + display: flex; + align-items: center; + gap: 18px; + height: 64px; + z-index: 10; + color: var(--ink); +} +.logo-watermark.top-left { top: 90px; left: 110px; } +.logo-watermark.top-right { top: 90px; right: 110px; } +.logo-watermark.bottom-left { bottom: 60px; left: 110px; } +.logo-watermark.bottom-right { bottom: 60px; right: 110px; } +.logo-watermark svg { + width: 64px; + height: 64px; + flex-shrink: 0; + /* Magnet logo PNG already has transparent paper-tone background; + * no rounded box needed -- it sits on the paper card directly. */ +} +.logo-wordmark { + font-size: 0 !important; + line-height: 0 !important; + /* Hide the upstream "ScudoAI" text node entirely. */ +} +.logo-watermark::after { + content: 'wro.cpp'; + font-family: var(--font-display); + font-weight: 700; + font-size: 28pt; + letter-spacing: -0.025em; + color: var(--ink); + line-height: 1; + /* The .cpp portion is given orange via a ::first-line trick below + * isn't reliable for inline -- so the SKILL writes the wordmark + * with explicit spans when it owns the markup. For this default + * rendering, the whole wordmark is ink and the orange comes through + * the bottom border + eyebrow. */ +} +.logo-watermark.top-right::after, +.logo-watermark.bottom-right::after { order: -1; margin-right: 18px; } + +/* ---------------- AI DISCLOSURE BADGE ---------------- */ +/* A small, honest "AI-GENERATED" label so the disclosure rides with the + * card image on social. Bottom-right corner (logo is top-left, citation is + * center-bottom, so this corner is free). Injected into index.html by + * inject.sh. See the /ai policy page. */ +.ai-badge { + position: absolute; + bottom: 74px; /* clears the 6px orange accent bar; sits in the bottom padding band */ + right: 110px; /* matches the card side padding / logo inset */ + z-index: 10; + font-family: var(--font-mono); + font-size: 14pt; + font-weight: 500; + letter-spacing: 0.10em; + text-transform: uppercase; + color: var(--ink-faint); +} + +/* ---------------- Defensive overrides ---------------- */ +/* Anything brand-gen might have set inline using its tokens. */ +* { box-sizing: border-box; } diff --git a/social/facebook/from-chars-formats-table/caption.md b/social/facebook/from-chars-formats-table/caption.md new file mode 100644 index 00000000..725c4e42 --- /dev/null +++ b/social/facebook/from-chars-formats-table/caption.md @@ -0,0 +1,18 @@ +# std::from_chars rejects a leading plus, and hex reads 1e3 as 483 + +## Body +The string 1e3 has three answers in std::from_chars, depending on the format. General gives 1000, fixed stops after the 1 and returns 1 with no error, and hex reads 483. + +I ran 14 inputs through the four formats on GCC 16.2 and clang 22.1, with libstdc++ and libc++. A leading plus and a leading space fail in all four. The two libraries agree on every count and error code, and differ in the value left after an out-of-range result. + +https://wrocpp.github.io/posts/from-chars-formats-table/ + +## Hashtags +#cpp #cpp17 #charconv #parsing #wrocpp + +## Alt-text +wro.cpp card with the magnet logo. Headline reads "from_chars reads 1e3 as 1000, 1 or 483" with a subtitle about the four chars_format values. Citation footer: wro.cpp, 2026-12-20. + +## Suggested post time +Sunday 2026-12-20, 08:00 UTC +Reason: the morning slot on the publication day. diff --git a/social/facebook/from-chars-formats-table/config.yaml b/social/facebook/from-chars-formats-table/config.yaml new file mode 100644 index 00000000..8a19da6c --- /dev/null +++ b/social/facebook/from-chars-formats-table/config.yaml @@ -0,0 +1,12 @@ +template: social/linkedin-post + +size: + width: 1200 + height: 1200 + dpr: 2 + +project: + name: "from-chars-formats-table" + author: "Filip Sajdak, Founder & CEO" + email: "office@scudoai.com" + date: "2026-12-20" diff --git a/social/facebook/from-chars-formats-table/content.md b/social/facebook/from-chars-formats-table/content.md new file mode 100644 index 00000000..8bc6d518 --- /dev/null +++ b/social/facebook/from-chars-formats-table/content.md @@ -0,0 +1,12 @@ +--- +template: social/linkedin-post +--- + +::::post{type=insight theme=dark logo=top-left} + +:::insight{citation="wro.cpp -- 2026-12-20"} +# from_chars reads 1e3 as 1000, 1 or 483 +The same string gives three answers, depending on the chars_format. A leading plus and a leading space fail in all four. libstdc++ and libc++ differ in one value. +::: + +:::: diff --git a/social/facebook/from-chars-formats-table/image.png b/social/facebook/from-chars-formats-table/image.png new file mode 100644 index 00000000..b189e81e Binary files /dev/null and b/social/facebook/from-chars-formats-table/image.png differ diff --git a/social/facebook/from-chars-formats-table/index.html b/social/facebook/from-chars-formats-table/index.html new file mode 100644 index 00000000..8e91e1aa --- /dev/null +++ b/social/facebook/from-chars-formats-table/index.html @@ -0,0 +1,28 @@ + + + + + + from-chars-formats-table + + + + + + + + + + +

from_chars reads 1e3 as 1000, 1 or 483

The same string gives three answers, depending on the chars_format. A leading plus and a leading space fail in all four. libstdc++ and libc++ differ in one value.

wro.cpp -- 2026-12-20
ScudoAI
AI-generated
+ + \ No newline at end of file diff --git a/social/facebook/from-chars-formats-table/media/.gitkeep b/social/facebook/from-chars-formats-table/media/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/social/facebook/from-chars-formats-table/media/README.md b/social/facebook/from-chars-formats-table/media/README.md new file mode 100644 index 00000000..bb81c7fa --- /dev/null +++ b/social/facebook/from-chars-formats-table/media/README.md @@ -0,0 +1,9 @@ +# Media directory + +Drop images here (PNG, JPG, SVG) for use in your post. + +Reference them in your content.md with: + + :::image{src="screenshot.png" alt="Alt text" position="top"} + +The renderer resolves paths relative to this media/ directory. diff --git a/social/linkedin/from-chars-formats-table/README.md b/social/linkedin/from-chars-formats-table/README.md new file mode 100644 index 00000000..85dc2af2 --- /dev/null +++ b/social/linkedin/from-chars-formats-table/README.md @@ -0,0 +1,130 @@ +# LinkedIn Square Post (1200x1200) + +Standard LinkedIn feed post at 1:1 square aspect ratio. Works well as a scroll-stopping image in the LinkedIn feed. + +## Usage + +```bash +brand-gen init social/linkedin-post my-post +cd my-post +# edit content.md +brand-gen build # -> index.html +brand-gen image # -> my-post.png (2400x2400 at 2x DPR) +``` + +## Directives + +All templates use one of four post types. Each uses the same directive pattern: + +### Quote + +```markdown +::::post{type=quote theme=dark logo=top-left} + +:::quote{author="Filip Sajdak" role="Founder & CEO, ScudoAI"} + +Sovereign AI is not a feature you bolt on later. It is the architecture. + +::: + +:::: +``` + +### Stat + +```markdown +::::post{type=stat theme=light accent=brand} + +:::stat{value="USD 80B" label="Worldwide sovereign cloud spend" context="Europe is the fastest-growing region at 83% YoY." source="Gartner, Feb 2026"} +::: + +:::: +``` + +### Announcement + +```markdown +::::post{type=announcement theme=light} + +:::announcement{kind="launch" date="April 2026"} + +# ScudoAI joins NVIDIA Inception + +We are thrilled to join the NVIDIA Inception program to accelerate sovereign AI deployment across European regulated industries. + +::: + +:::: +``` + +### Insight + +```markdown +::::post{type=insight theme=dark} + +:::insight{citation="EU AI Act full enforcement: 2 August 2026"} + +# The AI compliance deadline most companies are missing + +Full EU AI Act enforcement for high-risk AI systems begins in 2 August 2026. Most regulated enterprises are not ready for the documentation and audit requirements. Teams running cloud AI will face the hardest transition. + +::: + +:::: +``` + +## Attributes reference + +### `::::post` attributes + +- `type` - quote | stat | announcement | insight (required) +- `theme` - dark | light (default light) +- `accent` - brand | amber | nv (optional colored gradient background) +- `logo` - top-left | top-right | bottom-left | bottom-right (default bottom-right) + +### `:::quote` attributes + +- `author` - attribution name (appears below the quote) +- `role` - attribution role/title (appears under the author) + +### `:::stat` attributes + +- `value` - the big number (e.g. "USD 80B", "3/4", "Hours to minutes") +- `label` - short label under the value +- `context` - 1-2 sentences providing context +- `source` - small citation + +### `:::announcement` attributes + +- `kind` - launch | milestone | event | hire | partnership +- `date` - free-form date string + +### `:::insight` attributes + +- `citation` - small footer citation (e.g. regulation reference) + +## Character limits + +- **Quote body**: ~120 characters for maximum readability at thumbnail size +- **Stat label**: ~40 characters +- **Stat context**: ~200 characters +- **Announcement headline**: ~80 characters +- **Announcement body**: ~250 characters +- **Insight hook**: ~100 characters +- **Insight body**: ~300 characters + +Posts that exceed these limits will still render but typography may shrink or content may clip. + +## Media + +Add a `media/` directory to the project and reference local files: + +```markdown +:::background{image="nvidia-thor.jpg" overlay="dark"} +::: + +:::image{src="product-screenshot.png" alt="ScudoAI compliance dashboard" position="top"} +::: +``` + +Paths are relative to the project's `media/` directory. diff --git a/social/linkedin/from-chars-formats-table/assets/brand-kit.json b/social/linkedin/from-chars-formats-table/assets/brand-kit.json new file mode 100644 index 00000000..bcd1e0b2 --- /dev/null +++ b/social/linkedin/from-chars-formats-table/assets/brand-kit.json @@ -0,0 +1,11 @@ +{ + "template": "social/linkedin-post", + "bundleSource": "scudoai-social.css", + "brandKitVersion": "0.1.0", + "vendoredAt": "2026-11-17T23:49:57.253Z", + "files": [ + "scudoai.css", + "layout.css", + "logo-symbol.svg" + ] +} diff --git a/social/linkedin/from-chars-formats-table/assets/layout.css b/social/linkedin/from-chars-formats-table/assets/layout.css new file mode 100644 index 00000000..e69de29b diff --git a/social/linkedin/from-chars-formats-table/assets/logo-symbol.svg b/social/linkedin/from-chars-formats-table/assets/logo-symbol.svg new file mode 100644 index 00000000..1fc44966 --- /dev/null +++ b/social/linkedin/from-chars-formats-table/assets/logo-symbol.svg @@ -0,0 +1,22 @@ + diff --git a/social/linkedin/from-chars-formats-table/assets/scudoai.css b/social/linkedin/from-chars-formats-table/assets/scudoai.css new file mode 100644 index 00000000..612b5a12 --- /dev/null +++ b/social/linkedin/from-chars-formats-table/assets/scudoai.css @@ -0,0 +1,343 @@ +/* ============================================================ + * wro.cpp social card -- standalone stylesheet + * + * Self-contained styling for brand-gen's `social/linkedin-post` + * output. Replaces (does NOT extend) the scudoai-social.css that + * brand-gen ships with -- the design language here is the + * wro.cpp 'Editorial Magnet' look used by src/styles/global.css, + * not the scudoai blue-indigo deck aesthetic. + * + * Source of truth for tokens: src/styles/global.css:12-30 in the + * wrocpp.github.io repo. + * + * Brand-gen markup we style: + *
+ *
(decorative, hidden) + *
(decorative, hidden) + *
+ *

...

+ *

...

+ *
...
+ *
+ *
+ * + * ScudoAI (hidden; replaced via ::after) + *
+ *
+ * + * Other card types (card-quote, card-stat, card-announcement) + * get analogous rules at the bottom. + * ============================================================ */ + +@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=JetBrains+Mono:wght@400;500;700&display=swap'); + +:root { + --paper: #FCFAF5; + --paper-2: #F3EFE6; + --paper-3: #E8E1D0; + --ink: #1B1B1D; + --ink-muted:#55555A; + --ink-faint:#8A8A90; + --rule: #D7D2C4; + --orange: #EA541E; + --orange-2: #D6481A; + --blue: #3EB5E9; + --blue-deep:#2E8FB8; + + --font-display: 'Quicksand', system-ui, -apple-system, sans-serif; + --font-body: 'Source Serif 4', Georgia, serif; + --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; +} + +html, body { + margin: 0; + padding: 0; + background: var(--paper); + color: var(--ink); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-family: var(--font-body); + font-size: 18px; + line-height: 1.6; +} + +/* Hide brand-gen decorative noise -- the wro.cpp aesthetic is calm + * and editorial, not a dark deck with glow + grid backgrounds. */ +.grid-bg, .glow { display: none !important; } + +/* ---------------- Card frame (1200x1200) ---------------- */ +.card { + position: relative; + width: 1200px; + height: 1200px; + background: var(--paper); + /* Faint warm radial wash, mirrors body { background-image } in + * src/styles/global.css:44-49 -- gives the paper texture without + * looking flat. */ + background-image: + radial-gradient(900px 700px at 80% -10%, rgba(234, 84, 30, 0.06), transparent 60%), + radial-gradient(800px 600px at -10% 110%, rgba(62, 181, 233, 0.05), transparent 60%); + overflow: hidden; + box-sizing: border-box; + padding: 130px 110px 130px 110px; + display: flex; + flex-direction: column; + /* Faint inner border gives the card a printed-page feel. */ + border-bottom: 6px solid var(--orange); +} + +/* Override: theme=dark cards still use paper. We keep the editorial + * light look across the board so the wro.cpp brand stays consistent. + * If the user really wants a dark variant later, this is the hook. */ +.card.dark { background: var(--paper) !important; color: var(--ink) !important; } +.card.dark h1, .card.dark h2, .card.dark p, +.card.dark blockquote { color: var(--ink) !important; } + +/* ---------------- INSIGHT card ---------------- */ +.card-insight { + justify-content: center; + padding-top: 200px; /* reserve space for logo watermark (top:90px + 64px + safety) */ +} +.card-insight .insight-content { + display: flex; + flex-direction: column; + gap: 60px; + max-width: 980px; +} +.card-insight h1 { + font-family: var(--font-display); + font-weight: 700; + font-size: 92pt; + line-height: 1.02; + letter-spacing: -0.025em; + color: var(--ink); + margin: 0; +} +.card-insight h1.title-long { + font-size: 72pt; + line-height: 1.06; + letter-spacing: -0.02em; + max-height: 420px; +} +.card-insight h1.title-xlong { + font-size: 56pt; + line-height: 1.10; + letter-spacing: -0.015em; + max-height: 440px; +} +/* Auto-accent: ++ in C++/C++26 turns orange, sentence-final period + * (when wrapped in ) turns blue. The skill writes + * the heading with these spans for the wro.cpp signature look. */ +.card-insight h1 .accent { color: var(--orange); } +.card-insight h1 .dot { color: var(--blue-deep); } +.card-insight p { + font-family: var(--font-body); + font-size: 30pt; + line-height: 1.5; + color: var(--ink-muted); + margin: 0; + max-width: 920px; +} +.card-insight .insight-citation { + font-family: var(--font-mono); + font-size: 18pt; + letter-spacing: 0.04em; + color: var(--ink-faint); + margin-top: 40px; + padding-top: 30px; + border-top: 1px solid var(--rule); + text-transform: lowercase; +} +.card-insight .insight-citation::before { + content: '// '; + color: var(--orange); + font-weight: 700; +} + +/* ---------------- QUOTE card ---------------- */ +.card-quote { justify-content: center; padding: 140px 110px; } +.card-quote .quote-content { display: flex; flex-direction: column; align-items: flex-start; } +.card-quote .quote-mark { + font-family: var(--font-display); + font-weight: 700; + font-size: 200pt; + line-height: 0.8; + color: var(--orange); + opacity: 0.20; + /* In-flow above the text (not floated in the corner) with a negative + * bottom margin so the mark nearly touches the first quote line. */ + margin: 0 0 -0.62em; +} +.card-quote .quote-body { + font-family: var(--font-display); + font-weight: 600; + font-size: 64pt; + line-height: 1.15; + letter-spacing: -0.02em; + color: var(--ink); + max-width: 980px; + margin: 0; +} +.card-quote .quote-attribution { + margin-top: 50px; + font-family: var(--font-mono); + font-size: 18pt; + color: var(--ink-muted); +} +.card-quote .quote-attribution::before { content: '-- '; color: var(--orange); } +/* author and role are adjacent spans with no separator in the markup; + * add one so they do not run together ("wro.cppC++26 ..."). */ +.card-quote .quote-attribution .role::before { content: ' / '; color: var(--ink-faint); } + +/* ---------------- STAT card ---------------- */ +.card-stat { justify-content: center; } +/* Value and label sit side by side (label wraps to stacked lines whose + * combined height roughly matches the value); context + source span the + * full width underneath. */ +.card-stat .stat-content { + display: grid; + grid-template-columns: auto 1fr; + grid-template-areas: + "value label" + "context context" + "source source"; + column-gap: 64px; + align-items: center; +} +.card-stat .stat-value { + grid-area: value; + font-family: var(--font-display); + font-weight: 700; + font-size: 240pt; + line-height: 0.82; + letter-spacing: -0.04em; + color: var(--orange); + margin: 0; +} +.card-stat .stat-label { + grid-area: label; + font-family: var(--font-display); + font-weight: 700; + font-size: 90pt; + line-height: 1.0; + letter-spacing: -0.02em; + color: var(--ink); + /* min-content forces a per-word wrap, so "codegen steps" stacks into + * two lines next to the value instead of running on one long line. */ + width: min-content; + margin: 0; +} +.card-stat .stat-context { + grid-area: context; + font-family: var(--font-body); + font-size: 26pt; + line-height: 1.45; + color: var(--ink-muted); + margin: 56px 0 0; + max-width: 880px; +} +.card-stat .stat-source { + grid-area: source; + margin-top: 44px; + font-family: var(--font-mono); + font-size: 18pt; + color: var(--ink-faint); +} +.card-stat .stat-source::before { content: '// '; color: var(--orange); } + +/* ---------------- ANNOUNCEMENT card ---------------- */ +.card-announcement { justify-content: center; } +.card-announcement .announcement-meta { + font-family: var(--font-mono); + font-size: 20pt; + text-transform: uppercase; + letter-spacing: 0.08em; + color: var(--orange); + margin-bottom: 30px; +} +.card-announcement .announcement-content h1, +.card-announcement .announcement-content h2 { + font-family: var(--font-display); + font-weight: 700; + font-size: 78pt; + line-height: 1.05; + letter-spacing: -0.02em; + color: var(--ink); + margin: 0; +} +.card-announcement .announcement-content p { + font-family: var(--font-body); + font-size: 28pt; + line-height: 1.5; + color: var(--ink-muted); + margin: 40px 0 0; + max-width: 900px; +} + +/* ---------------- LOGO WATERMARK ---------------- */ +/* brand-gen hard-codes "ScudoAI" in .logo-wordmark; we hide it and + * draw "wro.cpp" via ::after on the watermark. The orange ".cpp" mirrors + * the brand-mark in the site header. */ +.logo-watermark { + position: absolute; + display: flex; + align-items: center; + gap: 18px; + height: 64px; + z-index: 10; + color: var(--ink); +} +.logo-watermark.top-left { top: 90px; left: 110px; } +.logo-watermark.top-right { top: 90px; right: 110px; } +.logo-watermark.bottom-left { bottom: 60px; left: 110px; } +.logo-watermark.bottom-right { bottom: 60px; right: 110px; } +.logo-watermark svg { + width: 64px; + height: 64px; + flex-shrink: 0; + /* Magnet logo PNG already has transparent paper-tone background; + * no rounded box needed -- it sits on the paper card directly. */ +} +.logo-wordmark { + font-size: 0 !important; + line-height: 0 !important; + /* Hide the upstream "ScudoAI" text node entirely. */ +} +.logo-watermark::after { + content: 'wro.cpp'; + font-family: var(--font-display); + font-weight: 700; + font-size: 28pt; + letter-spacing: -0.025em; + color: var(--ink); + line-height: 1; + /* The .cpp portion is given orange via a ::first-line trick below + * isn't reliable for inline -- so the SKILL writes the wordmark + * with explicit spans when it owns the markup. For this default + * rendering, the whole wordmark is ink and the orange comes through + * the bottom border + eyebrow. */ +} +.logo-watermark.top-right::after, +.logo-watermark.bottom-right::after { order: -1; margin-right: 18px; } + +/* ---------------- AI DISCLOSURE BADGE ---------------- */ +/* A small, honest "AI-GENERATED" label so the disclosure rides with the + * card image on social. Bottom-right corner (logo is top-left, citation is + * center-bottom, so this corner is free). Injected into index.html by + * inject.sh. See the /ai policy page. */ +.ai-badge { + position: absolute; + bottom: 74px; /* clears the 6px orange accent bar; sits in the bottom padding band */ + right: 110px; /* matches the card side padding / logo inset */ + z-index: 10; + font-family: var(--font-mono); + font-size: 14pt; + font-weight: 500; + letter-spacing: 0.10em; + text-transform: uppercase; + color: var(--ink-faint); +} + +/* ---------------- Defensive overrides ---------------- */ +/* Anything brand-gen might have set inline using its tokens. */ +* { box-sizing: border-box; } diff --git a/social/linkedin/from-chars-formats-table/caption.md b/social/linkedin/from-chars-formats-table/caption.md new file mode 100644 index 00000000..1ac72a60 --- /dev/null +++ b/social/linkedin/from-chars-formats-table/caption.md @@ -0,0 +1,24 @@ +# std::from_chars rejects a leading plus, and hex reads 1e3 as 483 + +## Body +The string 1e3 has three different answers in std::from_chars, depending on the format you pass. + +I ran 14 inputs through the four chars_format values on GCC 16.2 and on clang 22.1 with libstdc++ and with libc++. Of the 56 results, 34 succeed, 15 are invalid and 7 are out of range. + +General format reads 1e3 as 1000. Fixed format stops at the exponent, consumes one character and returns 1, with no error. Hex format reads 1e3 as the hexadecimal number 483. A leading plus and a leading space fail in all four formats, while strtod accepts both. + +libstdc++ and libc++ agree on every consumed count and every error code. They differ in one value: after an out-of-range result libstdc++ leaves the variable alone, and libc++ writes infinity or 0, although the standard says it stays unmodified. + +The example checks all 56 results against a table and exits 0 only when they match. I also read how the two libraries parse: libstdc++ 16 calls fast_float, and libc++ uses LLVM libc code. Daniel Lemire's proposed fast_float hints are a separate pull request, open on 2026-11-17, and std::from_chars takes none of them. + +https://wrocpp.github.io/posts/from-chars-formats-table/ + +## Hashtags +#cpp #cpp17 #charconv #fromchars #parsing #floatingpoint #libstdcpp #wrocpp + +## Alt-text +wro.cpp card with the magnet logo. Headline reads "from_chars reads 1e3 as 1000, 1 or 483" with a subtitle about the four chars_format values, the leading plus and the libstdc++ and libc++ difference. Citation footer: wro.cpp, 2026-12-20. + +## Suggested post time +Sunday 2026-12-20, 08:00 UTC +Reason: the morning slot on the publication day. diff --git a/social/linkedin/from-chars-formats-table/config.yaml b/social/linkedin/from-chars-formats-table/config.yaml new file mode 100644 index 00000000..8a19da6c --- /dev/null +++ b/social/linkedin/from-chars-formats-table/config.yaml @@ -0,0 +1,12 @@ +template: social/linkedin-post + +size: + width: 1200 + height: 1200 + dpr: 2 + +project: + name: "from-chars-formats-table" + author: "Filip Sajdak, Founder & CEO" + email: "office@scudoai.com" + date: "2026-12-20" diff --git a/social/linkedin/from-chars-formats-table/content.md b/social/linkedin/from-chars-formats-table/content.md new file mode 100644 index 00000000..8bc6d518 --- /dev/null +++ b/social/linkedin/from-chars-formats-table/content.md @@ -0,0 +1,12 @@ +--- +template: social/linkedin-post +--- + +::::post{type=insight theme=dark logo=top-left} + +:::insight{citation="wro.cpp -- 2026-12-20"} +# from_chars reads 1e3 as 1000, 1 or 483 +The same string gives three answers, depending on the chars_format. A leading plus and a leading space fail in all four. libstdc++ and libc++ differ in one value. +::: + +:::: diff --git a/social/linkedin/from-chars-formats-table/image.png b/social/linkedin/from-chars-formats-table/image.png new file mode 100644 index 00000000..9a2f4532 Binary files /dev/null and b/social/linkedin/from-chars-formats-table/image.png differ diff --git a/social/linkedin/from-chars-formats-table/index.html b/social/linkedin/from-chars-formats-table/index.html new file mode 100644 index 00000000..8e91e1aa --- /dev/null +++ b/social/linkedin/from-chars-formats-table/index.html @@ -0,0 +1,28 @@ + + + + + + from-chars-formats-table + + + + + + + + + + +

from_chars reads 1e3 as 1000, 1 or 483

The same string gives three answers, depending on the chars_format. A leading plus and a leading space fail in all four. libstdc++ and libc++ differ in one value.

wro.cpp -- 2026-12-20
ScudoAI
AI-generated
+ + \ No newline at end of file diff --git a/social/linkedin/from-chars-formats-table/media/.gitkeep b/social/linkedin/from-chars-formats-table/media/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/social/linkedin/from-chars-formats-table/media/README.md b/social/linkedin/from-chars-formats-table/media/README.md new file mode 100644 index 00000000..bb81c7fa --- /dev/null +++ b/social/linkedin/from-chars-formats-table/media/README.md @@ -0,0 +1,9 @@ +# Media directory + +Drop images here (PNG, JPG, SVG) for use in your post. + +Reference them in your content.md with: + + :::image{src="screenshot.png" alt="Alt text" position="top"} + +The renderer resolves paths relative to this media/ directory. diff --git a/src/content/posts/2026-12-20-from-chars-formats-table.mdx b/src/content/posts/2026-12-20-from-chars-formats-table.mdx new file mode 100644 index 00000000..35b0b1f6 --- /dev/null +++ b/src/content/posts/2026-12-20-from-chars-formats-table.mdx @@ -0,0 +1,88 @@ +--- +title: "std::from_chars rejects a leading plus, and hex reads 1e3 as 483" +slug: "from-chars-formats-table" +pubDate: 2026-12-20 +author: filip-sajdak +language: en +kind: short +audience: working-cpp +tags: [cpp, cpp17, from_chars, charconv, parsing, floating-point, libstdcpp, libcxx] +summary: "Fourteen inputs through std::from_chars with four chars_format values give 56 results: 34 succeed, 15 are invalid and 7 are out of range. A leading plus and a leading space fail in all four formats. hex reads 1e3 as 483 and fixed stops after the 1. libstdc++ and libc++ agree on every count and every errc, and differ only in the value left after an out-of-range result." +draft: false +relatedPosts: [] +--- + +import GodboltEmbed from '../../components/GodboltEmbed.astro'; + +The floating-point `std::from_chars` takes a format argument, and its four values give four different parsers. I ran fourteen inputs through all four on GCC 16.2 and on clang 22.1, with libstdc++ and with libc++. Of the 56 results, 34 succeed, 15 are invalid and 7 are out of range. Several of the successes are not what the input says. + +## In short + +- A leading `+` and a leading space fail in all four formats. `std::strtod` accepts both. +- Hex format reads hexadecimal digits with the prefix assumed, so `1e3` is 483 and `1.5` is 1.3125. +- Fixed format stops at the exponent. `1e3` succeeds, consumes 1 character and returns 1. +- Scientific format fails on `1.5`, because it requires an exponent. +- libstdc++ and libc++ agree on every consumed count and every error code. They differ in one thing: the value left after an out-of-range result. +- Daniel Lemire's proposed hints for `fast_float` are a separate API, and its pull request was open on 2026-11-17. The standard function takes none of them. + +## The table + +Each cell is the number of characters consumed, then the result. The variable starts at -7. The rows come from GCC 16.2 with `-std=c++26 -O2`, and clang 22.1 with libstdc++ gives the same rows. + +| input | general | fixed | scientific | hex | +|---|---|---|---|---| +| `1.5` | 3, 1.5 | 3, 1.5 | 0, invalid | 3, 1.3125 | +| `1e3` | 3, 1000 | 1, 1 | 3, 1000 | 3, 483 | +| `1.5e` | 3, 1.5 | 3, 1.5 | 0, invalid | 4, 1.3671875 | +| `0x1p4` | 1, 0 | 1, 0 | 0, invalid | 1, 0 | +| `1p4` | 1, 1 | 1, 1 | 0, invalid | 3, 16 | +| `+1` | 0, invalid | 0, invalid | 0, invalid | 0, invalid | +| ` 1` | 0, invalid | 0, invalid | 0, invalid | 0, invalid | +| `1,5` | 1, 1 | 1, 1 | 0, invalid | 1, 1 | +| `-0` | 2, -0 | 2, -0 | 0, invalid | 2, -0 | +| `1e999` | 5, out of range | 1, 1 | 5, out of range | 5, 125337 | + +`inf` and `nan` parse to 3 characters in all four formats. A string of 400 nines is out of range in the general, fixed and hex formats, and invalid in the scientific one. + +## Rows a working programmer gets wrong + +**A success with a short count.** Fixed format on `1e3` reports no error. The pointer sits after the `1`, and the value is 1. Code that checks the error code and ignores the pointer stores 1 where the input said 1000. The same happens for `1,5`, which gives 1 in three of the four formats. + +**`0x1p4` in general format.** It consumes the `0`, stops at the `x` and reports success with value 0. The standard has the same example for `0x123`. `std::strtod` reads `0x1p4` whole as the hexadecimal float 16 and consumes 5 characters. Hex format wants the digits alone, so `1p4` gives 16. + +**Hex takes any hex digit.** The input `1e3` is 0x1e3. The input `1.5e` consumes its last character as a digit and gives 1.3671875. General format stops before it and consumes 3. + +**The leading plus.** [The standard](https://eel.is/c++draft/charconv.from.chars) takes the pattern of `strtod`, except that a plus sign may only appear in the exponent. All four formats reject `+1` and ` 1`. Input with a leading plus or space needs a manual skip before the call. The program also runs `std::strtod` on ` +1`: value 1, 3 characters consumed. + +The standard also says the pattern is the one of the "C" locale. I did not run a locale test, so that part is the standard's word, not my measurement. + + + +## Do libstdc++ and libc++ agree + +On every consumed count and every `errc`, yes. I ran the same file with clang 22.1 and `-stdlib=libc++` on Compiler Explorer, and the 56 results match in count and error code. + +One value differs. After an out-of-range result, libstdc++ leaves the variable at -7. libc++ writes infinity for `1e999` and for the 400 nines, and 0 for `1e-999`. All 7 out-of-range cells show it. + +```text +libstdc++ 1e999 g:5/rng/-7 s:5/rng/-7 +libc++ 1e999 g:5/rng/inf s:5/rng/inf +``` + +The same page of the standard says the value is unmodified in that case. The example does not assert the value of an out-of-range cell, so it exits 0 on both libraries. Code that reads the variable after an out-of-range result sees a different number on each. + +## Where fast_float fits + +libstdc++ takes the work from the `fast_float` library. In the GCC 16 release branch, [`floating_from_chars.cc`](https://github.com/gcc-mirror/gcc/blob/releases/gcc-16/libstdc++-v3/src/c++17/floating_from_chars.cc) calls it for single and double precision when both are IEEE binary types. Hex format has its own function in that file. + +I read the libc++ side too. In llvm-project, [`libcxx/src/include/from_chars_floating_point.h`](https://github.com/llvm/llvm-project/blob/main/libcxx/src/include/from_chars_floating_point.h) includes headers from LLVM libc, and the file does not mention `fast_float`. I read both files on 2026-11-17 and did not build either library. + +Daniel Lemire's post of 10 November 2026, ["Telling your number parser what to expect"](https://lemire.me/blog/2026/11/10/telling-your-number-parser-what-to-expect/), is about `fast_float` itself. It proposes three hints, passed as a template argument. The names are `unpredictable_sign`, `short_numbers` and `assume_round_to_nearest`. Each tells the parser something about the data, so it can skip branches. For random-sign price changes on an Apple M4 Max, the post reports 153 million numbers per second without hints and 345 million with all three. Those are his numbers, and I did not measure them. + +On 2026-11-17 the change, [pull request 434 on fastfloat/fast_float](https://github.com/fastfloat/fast_float/pull/434), was open and unmerged. The hints are not a format value, and the standard function has no parameter for them. The format is the only hint it takes today, and the table shows how much it already decides. + +## What I would do + +Check the returned pointer as well as the error code. Compare it with the end of the input when the whole string must be a number. Strip a leading plus and white space before the call. Pick the general format unless the format is part of the data contract, and write a test row for each input shape you accept. Do not read the value after an out-of-range result. + +The sources, all outputs and the Compiler Explorer links are in [`posts/131-from-chars-formats`](https://github.com/wrocpp/cpp26-reflection-examples/tree/e7afe46/posts/131-from-chars-formats). The runs were made on Compiler Explorer on 2026-11-17: GCC 16.2, and clang 22.1 with libstdc++ and with libc++. I did not run MSVC, `float`, `long double` or any timing.