-
Notifications
You must be signed in to change notification settings - Fork 50
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
Highlight commands in descriptions #545
Comments
Related: #309 . |
Just to be clear about the higlight attribute, there is a |
Yeah, we should add a new |
Note, the difficulty with applying attributes to things in descriptions is that we have to give text to a function that does the text wrapping and constructs a widget. So we have no opportunity to apply formatting to individual words. This might require some kind of upstream PR to |
Well at least the triple backtick examples should be doable with separate widgets. I wonder if we could compose widgets so that they would still look like text and create our |
Maybe? I am not 100% sure how easy that will be.
I'm not sure I understand what you mean. |
I thought we could layout parts of the text to look like one text. But looking at |
I split out the easier part for highlighting code blocks. As a prerequisite, we should change the inline code to use backticks, so that we can at least find it and get markdown support for free. AFAIK we only use it for valid swarm commands, but in case we wanted to support more languages, Pandoc has an Extension: inline_code_attributes that looks like this: Try typing `build {}`{.swarm} - ... |
I think at this point most (all?) of the inline code in entity descriptions, tutorial goal text, etc. has been converted to use backticks. |
@byorgey thanks for updating on this. 👍 Next up, we need new data structure to represent text that has parts of it code. After that we have to wrap that type by lines (not widgets). Once we have lines those can be turned into widgets. Or we wait a little while until brick/other library makes the wrapping and assigning attributes easier for us. This is mostly a TLDR of the discussion in jtdaugherty/brick#400. |
* use CommonMark to parse simple markdown AST parametrised on inline/block code * validate swarm code (`Document Text -> Document Syntax`) * update descriptions to use markdown with following conventions: - `move` - valid swarm code (the easy to write default) - `wedge`{=entity} - for swarm entities - `unit`{=type} - for swarm types - `require <a> <b>`{=snippet} - raw snippets for invalid code - **Alt-G** - bold for keyboard shortcuts - highlight code in brick widgets - closes #309 - closes #545 - precedes #574 - precedes #1406 - precedes #1407
I want the commands in descriptions (entities, goal) to be highlighted instead of surrounded with ticks.
For shorter descriptions, it does not matter, but with longer ones like the goal or grabber device, I find it hard to read.
This would also be a good opportunity to use backticks to disambiguate them from normal ticks that English uses and be compatible with Markdown syntax.
As a small code refactoring, we could call the attribute "highlight" instead of using the robot attribute. 😅
update, 15 May 23: Collecting some related links here for easy access: #309, #574, jtdaugherty/brick#400, #1106
The text was updated successfully, but these errors were encountered: