-
Notifications
You must be signed in to change notification settings - Fork 858
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
Auto-scaling font sizes #159
Comments
Sorry for the slow reply. If your up for taking a stab that would be awesome! You're not the only one interested in such a feature. |
I'm definitely new to the JS world though so would need some review and oversight. Will take a stab at it. |
Subscribing ! Let me know if i can help you. |
Did you make any progress with this feature? If not I may take a look. Another such library is http://www.zachleat.com/web/bigtext-makes-text-big/ |
Nope - I wasn't able to get much done unfortunately. |
OK, I'm going to take a look at this and see what I can do. |
@gnab What's your thoughts on utilising jQuery to support this? It seems that all the libraries that would offer this functionality depend on jQuery. |
It would be nice if jQuery wasn't required to use remark. If jQuery is needed for this feature, maybe it can be an optional plugin that depends on jQuery, that is not bundled by default. If you can make it work the way you want with jQuery first, we'll take it from there. Maybe we can bundle only the parts of jQuery that is needed, or even implement it ourselves. |
I can understand that. I will see what aspects of jQuery it utilises and see if it's something we can reimplement using standard JavaScript. |
The https://github.com/gnab/remark/blob/develop/src/remark/views/slideView.js#L29 The dimensions remain the same unless the ratio of the slideshow is modified after creation. Window resizing is handled by scaling the entire slide, so font-sizing should only be needed in after the slide's dimensions are set/updated in the above function. |
Does anyone have a solution for this issue? Maybe a prototype of implementation? |
Hi @aseigneurin Personnaly I moved to reveal.js for my presentations. |
@kgaut: do you imply that reveal.js does auto-scaling? |
According reveal.js README, it does: https://github.com/hakimel/reveal.js/#presentation-size I like remark because it doesn't require a web server to interpret Markdown 👍 |
Quick solution using jquery-quickfit: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>
<script src="https://cdn.rawgit.com/chunksnbits/jquery-quickfit/master/jquery.quickfit.js"></script>
<script>
var slideshow = remark.create();
$('.remark-slide-content').quickfit({'min': 10, 'max': 36});
</script> In case the text still flows out, just replace |
I added this to my Story website theme with a quick hack in the HTML source of the file that contains the Remark slide. This depends on JQuery, and on the slide having the fit-h1 h1 {
height: 1.25em;
overflow: hidden;
} // Shrink headers until they fit. (They have to be momentarily made
// visible first.)
$(".remark-slide-content.fit-h1 h1").each(function(i, e) {
var $e = $(e);
var $p = $e.closest('div.remark-slide-container');
var needsToggle = !$p.hasClass('remark-visible');
console.log(needsToggle);
if ( needsToggle ) $p.toggleClass('remark-visible');
while (e.scrollHeight > e.clientHeight + 1 && $e.css('font-size') != '1px') {
$e.css('font-size', (parseInt($e.css('font-size')) - 1) + "px");
// console.log($e.css('font-size') + "sh:" + e.scrollHeight + "ch:" +
// e.clientHeight);
}
if ( needsToggle ) $p.toggleClass('remark-visible');
}); |
I use FitText.js resolved this problem.
quick command here: |
Documented here, thanks all! https://github.com/gnab/remark/wiki/HTML-CSS-JS-samples |
I've been using Remark for a class I've been teaching after wanting to take advantage of syntax highlighting and think it's awesome. One thing I wish it had was the ability to automatically resize font sizes on each slide similar to what Keynote does.
I'll be glad to take a stab at this if people think it's a decent idea and it would definitely be implemented as a separate option.
The text was updated successfully, but these errors were encountered: