commit bda3a59f912cb18a4d663237ab748af5b01eaa5d
parent 1cffbdbf3d668518a8af2dcbff681f77977a0b83
Author: Hugo Hörnquist <hugo@hornquist.se>
Date: Sun, 14 Oct 2018 23:31:26 +0200
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.
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim
@@ -1072,7 +1072,9 @@ function! s:process_tag_h(line, id)
let h_text = num.' '.h_text
endif
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
@@ -1088,7 +1090,7 @@ function! s:process_tag_h(line, 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
endif
diff --git a/autoload/vimwiki/style.css b/autoload/vimwiki/style.css
@@ -25,6 +25,7 @@ del {text-decoration: line-through; color: #777777;}
.justcenter {text-align: center;}
.center {margin-left: auto; margin-right: auto;}
.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
+.header a {text-decoration: none; color: inherit;}
/* classes for items of todo lists */
.rejected {