Document TextBox with markdown does not function as expected
See original GitHub issueWhen using markdown within a TextBox
it is not rendered as expected.
Consider a TextBox
with the following options:
// ...
contentHasMarkup : true,
wordWrap : true,
Then call the following:
const s = '^GRangers ^-^gare masters of the hunt, often living very independent lives or even occasionally as hermits. Skilled with ^Yranged weapons^-^g, ^GRangers ^-^gprefer to keep their enemies at a distance during combat.';
textbox.setContent(s, true);
Results look something like this:
Expected: ", " and “prefer…” text should be “dim” Green.
Another oddity that I’m not sure is expected: “^Gfoo ^gbar” I would expect to be bright Green “Foo” and dim “bar”, but I seem to have to insert ^-
between since the bright toggles on?
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Bootstrap markdown not working as expected - Stack Overflow
It is a pretty basic fiddle with just a text area and the markdown code, but as you can see, it does not...
Read more >15 Common Problems with rmarkdown (and some solutions)
15.1 Avoiding problems · restart R · run all chunks below · find the chunk that did not work, fix until it does...
Read more >Markdown User Guide - Skillable
Some key codes may not function as expected when using vSphere. It is highly recommended to test each key combo before publishing the...
Read more >Handbook Markdown Guide - GitLab
This method works for YouTube videos and any other embed video within an <iframe> tag. Copy the code below and paste it into...
Read more >Formatting text with Markdown - Zendesk help
Markdown is a simple markup language you can use to easily add formatting, links, and images to plain text. You can use it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@NuSkooler Great PoC 😉
On your
ansi-bbs.js
termconfig, you need to turn offdeltaEscapeSequence: false
(at the end of the file). It should greatly improve the support. It tells the ScreenBuffer to fully reset color/attribute anytime a cell has different style that the previous one during a blit (this only affect the blit, not how markup is interpreted).Yes, you can add an
attr
option to almost all widgets. Set it toattr: { bgColor: 'black' }
. When attr is not set on a widget, it used the lib’s default one, usually the terminal default color like CSI 49 for background. It could use some other decent default when it make more sense (e.g. highlighting a button).@NuSkooler I’m saying you that that blink is coming from your termconfig, the
bgBrightRed
was the first line containing such reference to blink, I just copied the first occurrence.It really works fine on my end.
Also everything is backed by a ScreenBuffer, that’s why you got some extra ESC seq. When a particular widget is drawn, it doesn’t know what happened before, so it set everything that should be. Also each cell in the ScreenBuffer has some properties: defaultColor and the bgDefaultColor are, well, the default color of a cell. Everytime a ScreenBuffer surface is blitted it ensures each cell will be drawn with the correct color/attributes. It remembers color/attributes during that process so it only send necessary code between cell, but not between surface blit (everything can happen between 2 blits, including userland codes messing with attributes).
Also the markup was never meant to be a way of writing ESC seq, instead it is meant to convey features of Terminal Kit. You express what you want (color/attributes), the lib try its best to make it work across all supported platforms. E.g. bold in Terminal Kit is meant to write something using bold font. If the platform doesn’t support bold font, the termconfig should fallback to what is as close as possible of bold (in a User eXperience sense), eventually just disable it if no clean fallback is possible, but not wildly send “\x1b[1m” because “hey, it’s the bold code”. The lib is supposed to abstract that away, the userland code may not even know how terminals work (and how messy they are).