-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC Markdown sections #9853
RFC Markdown sections #9853
Conversation
I merged #9852, so hopefully the diff will be smaller soon. Maybe github needs a forced push in order to get clean up this PR? |
5eb3a85
to
897fa0b
Compare
TBH/my 2 cents: I don't particularly like/find it hard to read centered... personally I would prefer if they were all left-aligned. e.g.
|
I agree left-aligned is more readable. |
I also like left-aligned. |
+1 for left-aligned. |
:( Well, I'm a bit sad to see my nice centred titles going, but the community giveth and the community taketh away. Feel free to left-align everything. Personally I also think Title
======= looks nicer than Title
-=====- |
Centrism is so 1980s. |
Updated, it's now a little simpler (as @one-more-minute suggested):
|
# Note above can lose bold formatting | ||
# ensure at least that the underline is bold | ||
with_output_format(:bold, io) do io | ||
println(io, string(char) ^ min(1 + n, columns)) |
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.
I see what you're going for here but I think it would look cleaner to do min(2+length(text), columns÷2)
.
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.
That would do something different. This does the following for multiline titles:
This title is longer that the column width
so underline last line
========================
I think using div here would get some surprising/unstable/ugly behaviour.
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.
Sure, but it leads to weird behaviour if the last line happens to be short:
This title is longer that the column width so underline last
line
======
which looks a bit off to me, or even actively confusing since it's less obvious that it's a title.
The div code makes things more stable because the length of the underline will always be halfway across the terminal for long titles (and behaves the same way for short ones):
This title is longer that the column width so underline last
line
====================================
(Now I think about it, 2/3s the way across might look better, but that's a detail)
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.
I'm kinda "meh" on both (I think both can look weird in some cases) but personally I prefer my way! :p
Edit (pressed enter too early): I wonder if anyone else has solved this problem (of what looks nicer).
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.
Well, it looks quite nice when it's all centred ;)
How about a mix of both – as long as the last line, but no shorter than 2/3s, for example?
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.
Well, it looks quite nice when it's all centred ;)
true! ok, i'm gonna try either 1/2 or 1/3, see what looks "nicest", and we can change it later.
Some issues on underlining of titles that have bitten in the past on other projects:
Unfortunately libmojibake doesn't seem to handle the last two Whilst this doesn't say "don't try to align underlines" just be aware that they won't work in some cases. |
@elextr IMO if you use a non-monospace font you're going to have a bad terminal experience.
+1. |
a3ad81c
to
749cfb9
Compare
@one-more-minute hopefully this last commit is a nice compromise :) force pushed a rebase over your latest commits (re boldness), they work great! |
bump! |
Could you squash the commits? |
left align sections simplify markdown header underlines if md header runs over multiple lines ensure at least 1/3 columns
3d79c79
to
da1242b
Compare
Excellent! Thanks for merging @one-more-minute, squashed one but ran out of time this morning. |
No problem, thanks for the PR! |
This is on the top of #9852 (whitespace changes to Markdown) so please excuse the large diff in the first commit.This adds methods for sections and subsections in the terminal, as a partial fix for #9850.
I don't feel strongly about what these actually are (very happy to amend), but thought I would put this out there.
cc @one-more-minute