Conversation
|
superseeding #1478 - just as note for myself |
yihui
left a comment
There was a problem hiding this comment.
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-heightattribute 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. |
yihui
left a comment
There was a problem hiding this comment.
-
plugin-fontsettings.cssappears later thanstyle.css, which means for the same CSS selector,plugin-fontsettings.csshas precedence overstye.css, so I don't think you need!important(which we should typically avoid using). -
I didn't mean enumerating
line-heightvalues 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.
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? |
yihui
left a comment
There was a problem hiding this comment.
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>
yihui
left a comment
There was a problem hiding this comment.
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.