-
Notifications
You must be signed in to change notification settings - Fork 447
Apply markup in table cell #1483
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
Conversation
kou
left a comment
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.
+1
Can we improve alignment in ri --format=ansi? It seems that we should not count invisible ANSI escape characters for width.
|
@kou |
|
I think widths = header.zip(*body).map do |cols|
cols.map(&:size).max # Use `calculate_text_width instead of size
end
...
# a is :rjust | :ljust | :center, w is width
t.__send__(a, w)
↓
t.__send__(a, w + calculate_text_width(t) - t.size)And each formatter can override it if it needs special width calculation logic. ToRDoc#calculate_text_widthSimply return ToAnsi#calculate_text_widthRemove escape sequences before calculating width ToBs#calculate_text_widthI think ToBS also need another custom width calculation logic. |
|
@tompng |
|
🚀 Preview deployment available at: https://4ba19a13.rdoc-6cd.pages.dev (commit: 45a8180) |
tompng
left a comment
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.
Thank you 👍
In the documentation for methods like
test, backtick are used within table cells.While each parser handles backquotes within table cells, the generator does not.
As a result, the tags are displayed literally without being processed.
To resolve this, I propose that tag expressions should be properly handled within table cells as well.
Before
ri --format=bs test
ri --format=markdown test
ri --format=ansi
After
ri --format=bs test
ri --format=markdown test
ri --format=ansi