The default Vimwiki2HTML command of vimwiki will convert %toc to the directory of the current wiki entry, but will convert the secondary directory id to toc_1.1 (the id contains a dot), and in order to use bootstrap-scrollspy to implement scrolling detection Test (reference: How to implement web page scroll detection and fixed navigation bar at the top), dots cannot be used in the id.
Excuse me:
class="nav"
, this is also for using bootstrap-scrollspy. The help manual of vimwiki reads:
vimwiki-option-custom_wiki2html
------------------------------------ ------------------------------------------
Key Default value~
custom_wiki2html ''
Description~
The full path to an user-provided script that converts a wiki page to HTML.
Vimwiki calls the provided |vimwiki-option-custom_wiki2html| script from the
command-line, using '!' invocation.
The following arguments, in this order, are passed to the
|vimwiki-option-custom_wiki2html| script:
1. force : [0/1] overwrite an existing file
2. syntax : the syntax chosen for this wiki
3. extension : the file extension for this wiki
4. output_dir : the full path of the output directory, i.e. 'path_html'
5. input_file : the full path of the wiki page
6. css_file : the full path of the css file for this wiki
For an example and further instructions, refer to the following script:
$VIMHOME/autoload/vimwiki/customwiki2html.sh
To use the internal wiki2html converter, use an empty string (the default).
My level is limited and I cannot directly write an external script. I would like to refer to what vimwiki's default script looks like, but I don't know where the internal wiki2html converter
script is.
Now there are two methods:
1. Use sed for batch processing; use sed to modify the html generated by vimwiki to make it conform to the specifications. The script is as follows:
Note: The sed N command adds even lines to the buffer of odd lines, so <p class="toc"> needs to be placed on odd lines.
2. Modify the autoload/vimwiki/html.vim file as follows:
and
Thanks to themacropodus@gmail.com for the answer on Can I modified the internal wiki2html....