Repository navigation
fix(mobile): style inline code with the app mono face #6631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e53bcdd
db0c922
9983687
be77c64
13e1277
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| import 'message_typography.dart'; | ||
|
|
||
| /// The app's own code style — one place stating the mono face, its size and | ||
| /// the colours a code surface is drawn with. | ||
| /// | ||
| /// Two surfaces render code and they have to read as one family: the fenced | ||
| /// block in `MessageContent`, and the inline chip `gpt_markdown` paints from | ||
| /// the `InlineCodeStyle` declared in `AppTheme`. Both take their values from | ||
| /// here, so neither can drift from the other by editing one copy. | ||
| abstract final class CodeStyle { | ||
| /// The mono face, already used by the composer and by code blocks. | ||
| static const fontFamily = 'GeistMono'; | ||
|
|
||
| /// Code size at message body scale. | ||
| static const fontSize = 13.0; | ||
|
|
||
| /// Line height of code text. | ||
| static const lineHeight = 1.5; | ||
|
|
||
| /// [fontSize] stated against the message body size, for APIs that scale code | ||
| /// relative to the text around it rather than fixing a point size. Keeping | ||
| /// it a ratio means code follows the body if that size ever changes. | ||
| static final fontSizeFactor = fontSize / messageBodyTextStyle.fontSize!; | ||
|
|
||
| /// Fill behind a code surface. | ||
| static Color background(ColorScheme scheme) => | ||
| scheme.surfaceContainerHighest.withValues(alpha: 0.6); | ||
|
|
||
| /// Outline around a code surface. | ||
| static Color border(ColorScheme scheme) => | ||
| scheme.outline.withValues(alpha: 0.7); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ dependencies: | |
| nostr: ^2.0.0 | ||
| pointycastle: ^4.0.0 | ||
| url_launcher: ^6.3.2 | ||
| gpt_markdown: ^1.1.6 | ||
| gpt_markdown: ^1.2.1 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Handle the new autolinks in both agent-transcript renderers This bump enables The PR body explicitly accepts autolinking outside messages, but that needs an actual URL-opening handler. Either wire the handler for both surfaces and cover activation, or set |
||
| highlight: ^0.7.0 | ||
| intl: ^0.20.2 | ||
| uuid: ^4.5.1 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Preserve the ambient non-code Markdown theme when registering inline-code styling
GptMarkdownThemeData(brightness: ...)is not a partial override: its factory builds a fresh Material theme and fills every heading/divider field. Registering it makesGptMarkdownTheme.of(context)stop deriving those fields from the app theme. On this head, toggling only this extension changes H4 from 24 to 22sp, H5 from 20 to 16sp, H1 weight from 600 to 400, and horizontal rules fromscheme.outlineto Material gray, in both light and dark. Existing messages and forum content therefore change styling even without inline code; custom community outline colors are also lost.Preserve the app’s h1–h6 styles and divider color when constructing the extension (or otherwise retain the ambient defaults while overriding inline code). Add a non-code heading/divider regression test so this code-only change does not restyle the rest of Markdown.