Made headings link to themselves.

Made each heading link to itself, by placing an <a> tag inside each
<h[1-6]> tag.

Also adds class="header" to each header, allowing for the CSS rule
    .header a { ...  }
to remove all styling from the inner links, allowing the outputed
document to look like before.
This commit is contained in:
Hugo Hörnquist 2018-10-14 23:31:26 +02:00 committed by EinfachToll
parent 1cffbdbf3d
commit bda3a59f91
2 changed files with 5 additions and 2 deletions

View File

@ -1072,7 +1072,9 @@ function! s:process_tag_h(line, id)
let h_text = num.' '.h_text let h_text = num.' '.h_text
endif endif
let h_complete_id = s:escape_html_attribute(h_complete_id) let h_complete_id = s:escape_html_attribute(h_complete_id)
let h_part = '<div id="'.h_complete_id.'"><h'.h_level.' id="'.h_id.'"' let h_part = '<div id="'.h_complete_id.'">'
let h_part .= '<h'.h_level.' id="'.h_id.'" class="header">'
let h_part .= '<a href="#'.h_complete_id.'"'
else else
@ -1088,7 +1090,7 @@ function! s:process_tag_h(line, id)
let h_text = s:process_inline_tags(h_text, a:id) let h_text = s:process_inline_tags(h_text, a:id)
let line = h_part.h_text.'</h'.h_level.'></div>' let line = h_part.h_text.'</a></h'.h_level.'></div>'
let processed = 1 let processed = 1
endif endif

View File

@ -25,6 +25,7 @@ del {text-decoration: line-through; color: #777777;}
.justcenter {text-align: center;} .justcenter {text-align: center;}
.center {margin-left: auto; margin-right: auto;} .center {margin-left: auto; margin-right: auto;}
.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;} .tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
.header a {text-decoration: none; color: inherit;}
/* classes for items of todo lists */ /* classes for items of todo lists */
.rejected { .rejected {