Skip to content

Commit

Permalink
Merge pull request #305 from jonathanhefner/h1-no-hgroup-for-prose
Browse files Browse the repository at this point in the history
Conserve `<h1>` headings in prose files
  • Loading branch information
jonathanhefner authored Sep 14, 2023
2 parents ba82160 + 9074c14 commit 6f393ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/rdoc/generator/template/rails/file.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
<%= include_template '_panel.rhtml' %>

<main id="content">
<hgroup class="content__title">
<h1><span class="kind">File</span> <%= full_name file %></h1>
</hgroup>
<div class="content__title">
<%= "<h1>" if file.comment.empty? %>
<%= full_name file %>
<%= "</h1>" if file.comment.empty? %>
</div>

<% if source_url = github_url(file.relative_name) %>
<p><%= link_to_external "View on GitHub", source_url %></p>
<p class="content__source-link"><%= link_to_external "View on GitHub", source_url %></p>
<% end %>

<%= include_template '_context.rhtml', {:context => file} %>
Expand Down
9 changes: 7 additions & 2 deletions lib/rdoc/generator/template/rails/resources/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,13 @@ html {
font-style: normal;
}

.content__title :is(h1, p) {
.content__title {
font-size: 1.6em;
line-height: 1.25;
}

.content__title h1 {
font-size: inherit;
font-weight: normal;

margin-left: 1em;
Expand All @@ -479,6 +480,10 @@ html {
margin-top: 0;
}

.content__source-link {
margin-top: var(--space-sm);
}

.content__section-title {
margin: var(--space-xl) 0 0 0;

Expand Down Expand Up @@ -598,7 +603,7 @@ html {
* Description of method or module
*/

#context > .description {
.content__title ~ #context > .description {
margin-top: var(--space-lg);
}

Expand Down

0 comments on commit 6f393ab

Please sign in to comment.