ionelmc / python-darkslide

Generate HTML5 slideshows from markdown, ReST, or textile
http://ionelmc.github.io/python-darkslide/
Apache License 2.0
98 stars 22 forks source link

[Enhancement] Have a "Title Slide" class #15

Open superwhoopy opened 4 years ago

superwhoopy commented 4 years ago

Hello dear devs: first of all and as always, thank you for your great work and dedication!

Here goes:

Idea

Currently, a slide is considered as a title slide only if its content is made of just a level 1 title and no content.

I think it would be more flexible if, in addition to this default behavior, the user was able to tell for any slide that he wants it to be "Title Slide" (thus enabling specific styling). After all, the content of that slide could be more than just the title: there could be a subtitle, an author list, etc.

Implementation Suggestion

Title slides are currently identified in the CSS file using the psuedo-class :only-child, e.g.:

section, .slide header:only-child h1 {
    margin-left: 30px;
    margin-right: 30px;
    margin-top: 100px;
    display: block;
    overflow: hidden;
}

I suggest to remove this "hack" and create two classes slide_title and slide_with_content. By default, a slide with no content would be generated with the class slide_title, and other slides would be of class slide_with_content. The user could force a slide to be of class slide_title, e.g. with the .fx macro, or with a dedicated .titleslide macro (to be created).

This would enable CSS magicians to easily define different styles for title and non-title slides.

I am willing to do the implementation, I just need to know first if someone is interested...or if i can go fork myself :-).

Thanks again!

ionelmc commented 4 years ago

What I usually do is have stuff like .fx: special-slide and then have some user css like .special-slide header { blabla }.

Unfortunately fx macro is additive (you'd end up with class="slide_with_content slide_title") so your idea wouldn't work anyway?

superwhoopy commented 4 years ago

I guess you're right: I can use .fx: title_slide, and define in my user CSS the style for title_slide. That just "forces" me to add .fx: title_slide even for slides with no content, but it works.

I guess I was just looking for a reason to remove the :only-child selector 🙂