Skip to content

Apply smart typography inside box and conversation elements - #44

Merged
natolambert merged 2 commits into
mainfrom
fix-element-smart-typography
Jul 29, 2026
Merged

Apply smart typography inside box and conversation elements#44
natolambert merged 2 commits into
mainfrom
fix-element-smart-typography

Conversation

@natolambert

Copy link
Copy Markdown
Owner

Summary

Text inside box and conversation blocks didn't get smart typography: -- rendered as two literal hyphens and quotes stayed straight, while the surrounding slide text got proper en dashes and curly quotes (screenshot case: "The plan" box on rlhfbook.com lecture decks).

Root cause: the two elements construct their own bare MarkdownIt("commonmark", {"html": True}) instances, missing the typographer: true option and the replacements/smartquotes rules the main pipeline enables in _create_md_renderer.

Fix: factor the shared base config into colloquium/md.py (create_base_md()) and use it in the main pipeline, box.py, and conversation.py — so the three renderers can't drift again. The main pipeline still layers dollarmath on top; elements also gain table support, matching main-pipeline behavior.

Tests

Two new tests assert -- → – and "..." → curly quotes inside box content and conversation messages. Full suite: 237 passed, 1 skipped.

🤖 Generated with Claude Code

Nathan Lambert and others added 2 commits July 28, 2026 20:05
box and conversation built their own bare MarkdownIt instances, so
-- stayed literal and quotes stayed straight while the rest of the
slide got en dashes and smart quotes. Factor the shared renderer
config into colloquium/md.py and use it everywhere.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 078068e00a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread colloquium/md.py
Comment on lines +11 to +15
def create_base_md() -> MarkdownIt:
"""Return a markdown-it renderer with the deck's shared typography."""
md = MarkdownIt("commonmark", {"html": True, "typographer": True})
md.enable(["table", "replacements", "smartquotes"])
return md

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required Unreleased changelog entry

This PR adds user-visible smart-typography behavior, but its diff leaves CHANGELOG.md untouched, so the release notes omit the change despite the repository requirement that every PR add one PR-linked line under ## [Unreleased]. Add that summary before merging.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

@natolambert
natolambert merged commit 43f6e7f into main Jul 29, 2026
2 checks passed
natolambert added a commit to natolambert/rlhf-book that referenced this pull request Jul 29, 2026
Points the git pin at the natolambert/colloquium#44 merge commit so
box and conversation blocks render en dashes and smart quotes like
the rest of the slide text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant