-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Linespace customise FR #1479
Linespace customise FR #1479
Conversation
superseeding #1478 - just as note for myself |
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.
Two questions:
- What did you change in
inst/resources/gitbook/css/style.css
? I feel it shouldn't be necessary to change this file (I think all relevant CSS can be added toplugin-fontsettings.css
). - Instead of hard-coding a few line height choices, would it be better to only add two buttons (one for increasing, and one for reducing line height, say, by 0.1)? By clicking these buttons, you change the
data-line-height
attribute of the element.book .book-body .page-inner section
, and in CSS, you setline-height: attr(data-line-height)
. Then readers will have full freedom of choosing the most comfortable line spacing.
|
That should be the toggle option. Let me know what we should do on the CSS issue. |
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.
-
plugin-fontsettings.css
appears later thanstyle.css
, which means for the same CSS selector,plugin-fontsettings.css
has precedence overstye.css
, so I don't think you need!important
(which we should typically avoid using). -
I didn't mean enumerating
line-height
values in CSS, but using the CSS functionattr()
, which gives you full freedom to use any line height specified in an attribute of the DOM element. I hope that's clearer now.
Thanks!
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Hi there
I have committed your changes to my fork and tested them and they simply don't work. The spacing does not change with the buttons. |
merge in test branch
I don't think attr() works for line-height. This should work, I also added a minimum line height of 1 to prevent users from crossing text. |
There is an issue that if you click reduce a bunch of times after you have reached minimum, you have to click increase the same number of times to start making a difference. Not sure how to fix this without hardcoding options. This may be why font size was done in this way. |
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.
You are right. Sorry I forgot that attr()
currently only works for content
: https://developer.mozilla.org/en-US/docs/Web/CSS/attr
There is an issue that if you click reduce a bunch of times after you have reached minimum, you have to click increase the same number of times to start making a difference. Not sure how to fix this without hardcoding options.
When fontState.spacing <= 10
, we stop decreasing it.
BTW, is it still necessary to remove the default line-height from style.css
? The style
attribute usually has the highest precedence and will override most rules defined in external stylesheets.
Please also add a bullet item to NEWS.md
.
Co-authored-by: Yihui Xie <xie@yihui.name>
Yes we can now return the css to how it was as there is no changes to even the fontplugin css anymore. Should be that all the changes are in the JS page. |
Not sure why accepting that change seems to have caused tests to fail? Any ideas? |
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.
It seems that style.css
was not restored.
Not sure why accepting that change seems to have caused tests to fail? Any ideas?
I think you can ignore that. Looks like a change in the dev version of Pandoc irrelevant to this PR. We'll look into it.
Thanks!
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
Co-authored-by: Yihui Xie <xie@yihui.name>
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've tweaked the rest of minor things and the PR is ready to merge now. Thanks again!
Pull request for FR #1477. Tested on bookdown-demo.
Rationalle for options: 1.0, 1.5, 2.0, 2.5 and 3.0 are standard options while 1.7 was the default.
Happy to discuss any of this.