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
Make HTML5 header easier to style precisely in default template #4767
Conversation
f9662ca
to
9a16578
Compare
9a16578
to
2611aa3
Compare
I don’t understand the use case. How do you integrate Typora’s html/css with the one generated by pandoc? Shouldn’t you just produce an html fragment (without header/body) and place that in your cms? |
I use the same custom CSS stylesheet both as a Typora theme and when I use Pandoc to generate either a standalone HTML document or an HTML fragment. Sometimes I want a fragment (blog post) and sometimes I want a standalone document (article published as PDF, for which I use print-only CSS styles). It would be convenient to be able to use the same CSS stylesheet for all three cases. This also increases the likelihood that what I see in Typora is what I get when I process the document with Pandoc. Without this proposed change, I would need to maintain two different CSS stylesheets: one for Typora to use that doesn't style |
Why not use CSS to suppress Agreed that this is a fairly innocuous change, though there's always some risk of collisions with auto-generated identifiers when you put an identifier in the template. (Auto-generated identifiers are aware of duplicates within the document content, but they're not aware of what's in the template, so if you had a header As far as naming goes, I might favor something like |
@jgm I don't want to play Whack-a-Mole with whatever might show up in the header in the future as that template changes. It more directly reflects my intent to hide I'm happy to change the name to |
It looks like the Travis CI job failed, rather than the changes failing the build. I don't know how to re-trigger a build, otherwise I would just try it again. The Travis CI message suggests a stalled build, since it stopped after exactly 10 minutes. I'm trying to close, then reopen the pull request, hoping that will trigger a new build attempt. |
I can't read the Travis CI test failure here and I don't know why it only happens with the If someone more familiar with running the development environment for this project would point me in the right direction, I'd appreciate it; otherwise, I'm stuck and hoping that someone would be willing to step in. |
@jbrains this failure has nothing to do with your change. |
Thanks! I hoped so, but when the same thing failed twice, I wasn't sure any more. |
I've added an ID to the
header
element of the HTML5 template in order to style the element with a more-precise CSS rule. This should enable more flexibility without damaging any existing style rules out there which styled theheader
tag without reference to the ID I've added.Composing an article in Typora triggered this change. Pandoc's HTML5 template generates a
header
with document information that I didn't want to display, which led me to style it asheader { display: none; }
. Typora, unfortunately, uses theheader
tag to implement its editor sidebar, including useful things like a file tree and a document outline. By styling the document withheader { display: none; }
, I was turning that useful feature off. I wanted it back on.Yes, I could use just a local template override, but it seems to me that this change can only benefit users and not hurt them. Anyone who needs to style
header
will not be affected by the change and anyone who would be annoyed by stylingheader
instead of more specific subset of HTML nodes is pleasantly surprised by the helpful ID to select for their style rule. By the look of it, everyone wins.This would introduce a slightly different incompatibility between the HTML4 template (
<div id="{header-prefix}header">
) and the HTML5 template (<header id="document-summary-header">
), but a similar incompatibility was already there, so this change doesn't make that any worse. We could argue for a better ID for this element, and I really don't mind what it's called.