You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a code block is marked with a language, the Zulip server will try to apply code highlighting to it for that language. This highlighting is expressed by breaking the text into many short spans, each applying a CSS class from Pygments. This is then shown in Zulip web and zulip-mobile by providing CSS rules for those classes.
Currently we ignore the highlighting information and just show the text. We should instead parse the highlighting information and use it to show the highlighting.
In widgets/content.dart, this basically means transcribing the information that's in web's pygments.css into some Dart code that produces Flutter widgets. There's no magic bullet for this, but fortunately that information is not complicated.
There are 62 such classes. Each rule applies to one class. (There is also a pair of rules setting background-color for the whole code block, for 64 total rules in the file.)
The contents of the rules are various combinations of:
font-weight: bold;
font-style: italic;
color: hsl(…);
background-color: hsl(…);
border: …;
So all of those should translate very simply to Flutter widgets.
The text was updated successfully, but these errors were encountered:
When a code block is marked with a language, the Zulip server will try to apply code highlighting to it for that language. This highlighting is expressed by breaking the text into many short spans, each applying a CSS class from Pygments. This is then shown in Zulip web and zulip-mobile by providing CSS rules for those classes.
Currently we ignore the highlighting information and just show the text. We should instead parse the highlighting information and use it to show the highlighting.
In
widgets/content.dart
, this basically means transcribing the information that's in web'spygments.css
into some Dart code that produces Flutter widgets. There's no magic bullet for this, but fortunately that information is not complicated.There are 62 such classes. Each rule applies to one class. (There is also a pair of rules setting
background-color
for the whole code block, for 64 total rules in the file.)The contents of the rules are various combinations of:
font-weight: bold;
font-style: italic;
color: hsl(…);
background-color: hsl(…);
border: …;
So all of those should translate very simply to Flutter widgets.
The text was updated successfully, but these errors were encountered: