feat(typography): smart quotes automatici via remark-smartypants - #4
Merged
Conversation
Converte a build-time gli apici dritti della prosa in virgolette curve
tipografiche ("…" '…' e apostrofo ') su tutti i volumi, docs preset e
blog. Lavora sull'AST: blocchi di codice, inline code e attributi JSX
restano intatti, quindi il sorgente resta ASCII (comodo da scrivere) e
la conversione è permanente per costruzione — niente migrazione né
regole Prettier.
Il config diventa async per caricare remark-smartypants (ESM-only) con
import() dinamico. protectCode/restoreCode (plugins/smartypants-guard.js)
proteggono i children di <InlineCode>, che renderizza codice via testo e
non va smart-quotato.
Verificato sul build: H1/prosa con apici curvi, codice e <InlineCode
kind="string"> con apici dritti (0 falsi positivi). Limite noto:
title/meta/navbar derivano dal config/frontmatter e restano dritti
(non passano dalla pipeline remark).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
I titoli non passano dalla pipeline remark: le stringhe del config (titolo sito, navbar, footer, alt logo) non sono Markdown, e il <title>/meta delle pagine deriva dall'H1 grezzo letto prima di smartypants. Essendo testo di display puro (mai codice), il modo corretto è scrivere il carattere curvo U+2019 direttamente nel sorgente: rende curvo ovunque (tab, anteprima social, navbar, sidebar) a costo zero. Curvare l'H1 sistema sia il corpo (smartypants è idempotente) sia il <title> derivato. Verificato sul build: <title>, og:title e navbar tutti con apostrofo curvo. Chiude il "limite noto" della PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cosa
Abilita gli smart quotes (virgolette tipografiche curve) sull'intero sito: gli apici dritti scritti nel sorgente vengono convertiti in
"…"'…'e apostrofo'. La prosa è gestita a build-time; titoli, navbar e meta sono curvati alla fonte.Risolve il task 🟠 di v0.3.0 — "House in Order".
Prosa: conversione a build-time
remark-smartypantssu docs preset, blog e i 4 volumi converte gli apici della prosa mentre Docusaurus genera l'HTML.Dettagli:
remark-smartypantsè ESM-only → configasyncconimport()dinamico.<InlineCode>(plugins/smartypants-guard.js):<InlineCode>rende un<code>ma riceve il codice come children testuali (prosa per smartypants). Senza protezione<InlineCode kind="string">"Hello"</InlineCode>diventerebbe"Hello"(curvo) dentro codice.protectCode/restoreCodeavvolgono smartypants e proteggono questi children. Estendibile viaCODE_COMPONENTS.Titoli / navbar / meta: carattere curvo alla fonte
<title>, meta OG e label navbar non passano dalla pipeline remark (le stringhe del config non sono Markdown; il<title>deriva dall'H1 grezzo, letto prima di smartypants). Essendo testo di display puro — mai codice — la soluzione corretta è scrivere'(U+2019) direttamente nel sorgente: titolo sito, navbar, footer, alt logo nel config + i 3 H1 dei volumi. Curvare l'H1 sistema sia il corpo (smartypants è idempotente) sia il<title>derivato.Verifica sul build
<InlineCode kind="string">: apici dritti ✅ (0 falsi positivi dentro<code>)<title>, og:title, navbar: apostrofo curvo ✅ (es.Python Doesn't Byte,Manuale dell'Artefice | Python Doesn't Byte)npm run typecheck✅ ·npm run build✅ · lint dei file toccati ✅🤖 Generated with Claude Code