sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

publish_helper : vim code highlights in pandoc documents (HTML and TeX)

 script karma  Rating 1/1, Downloaded by 1684    Comments, bugs, improvements  Vim wiki

created by
Alexey Radkov
script type
  two commands for publishing highlighted code in HTML or TeX
  (optionally from pandoc as highlighting engine from filter vimhl.hs)

  github: http://github.com/lyokha/vim-publish-helper

  The commands may be used from within vim. Additionally they can act as
  the highlighting engine from pandoc having been inserted inside filter
  vimhl.hs shipped with this distribution.

  Command :MakeHtmlCodeHighlight to create a new buffer in a new window with
  HTML code correctly highlighted accordingly to the current color scheme or
  scheme declared in variable g:PhColorscheme. The command uses TOhtml
  internally with temporarily set value g:html_use_css = 0

  Command :MakeTexCodeHighlight to create a new buffer in a new window with
  TeX code correctly highlighted accordingly to the current color scheme or
  scheme declared in variable g:PhColorscheme. The command accepts optional
  argument which defines that lines will be enumerated. If the argument is
  missing then no line enumeration will be generated, if it is negative then
  lines will be enumerated from the number of the first line in the original
  buffer, otherwise lines will be enumerated from the value of the argument.

  The both commands can act as the highlighting engine in filter vimhl.hs
  shipped with this distribution. This program is supposed to be used like

  pandoc -f html -t latex -F vimhl.hs -o document.tex document.html

  It is possible to compile vimhl.hs:

  ghc --make vimhl

  Move vimhl.hs (or compiled program vimhl) somewhere in your $PATH.

  When converting formats with pandoc ensure that original file has
  additional parameter hl="vim" inside tag <pre> (as an example for HTML):
  only in this case pandoc will choose vimhl.hs as highlighting filter.

  There are two other commands :GetFgColorUnderCursor and
  :GetBgColorUnderCursor. They are included as they may help in debugging
  and finding foreground or background colors under cursor. Normally i use
  them in maps like following:

  nmap <silent> ,vc :GetFgColorUnderCursor<CR>
  nmap <silent> ,vb :GetBgColorUnderCursor<CR>

Thanks to:
  Christian Brabandt for plugin Colorizer and Xterm2rgb translation functions
install details
Prerequisites for using as a pandoc filter: pandoc version 1.12 or greater, haskell

1. Extract the tarball in your $HOME/.vim directory
2. Move vimhl.hs into a directory listed in the $PATH and make it executable.
    Or better compile vimhl.hs:
        ghc --make vimhl
    and move vimhl into a directory listed in the $PATH.
3. :helptags ~/.vim/doc/

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-publish-helper-0.12.2.tgz 0.12.2 2016-09-27 7.3 Alexey Radkov files structure reorganized, misc enhancements, filter vimhl can now be installed with cabal
vim-publish-helper-0.12.1.tgz 0.12.1 2015-02-06 7.3 Alexey Radkov fixed broken in version 0.12 tex / pdf output
vim-publish-helper-0.12.tgz 0.12 2015-01-13 7.3 Alexey Radkov     - added an option for line numbering as an HTML table effective in
      the internal HTML syntax highlighting engine only: set variable
      g:PhLinenrAsTblColumn and enjoy it (see updated docs)
    - several improvements in script vimhl_latex_tmpl.sh
    - minor refactoring of vimhl.hs
vim-publish-helper-0.11.tgz 0.11 2014-05-26 7.0 Alexey Radkov     - added support for rich text elements: text background color, bold,
      italic and underline typefaces and turned it on by default
    - speed improvements, now commands may run about 30% faster
vim-publish-helper-0.10.tgz 0.10 2014-03-18 7.0 Alexey Radkov     - added support for highlighting various shells outputs
    - added an example with images on github
vim-publish-helper-0.9.tgz 0.9 2014-03-15 7.0 Alexey Radkov     - further improvements in TOhtml rendering engine (completed in 0.8.x series)
    - added new variable g:PhTexBlockStyle to customize code blocks visual
      parameters in TeX documents
    - added an auxiliary script vimhl_latex_tmpl.sh for making pandoc
      templates for TeX compatible with vimhl (see updated docs)
vim-publish-helper-0.8.3.tgz 0.8.3 2014-02-21 7.0 Alexey Radkov     - properly restore global variables related to TOhtml
    - minor (mostly stylistic) imrovements in vimhl.hs
vim-publish-helper-0.8.2.tgz 0.8.2 2014-02-14 7.0 Alexey Radkov fixed trim algorithm in TOhtml engine; minor fixes and improvements
vim-publish-helper-0.8.1.tgz 0.8.1 2014-02-11 7.0 Alexey Radkov fixed possible error messages about not found patterns when using Tohtml engine
vim-publish-helper-0.8.tgz 0.8 2014-02-11 7.0 Alexey Radkov     - both HTML rendering engines do not use tag <tt> any longer
    - improved TOhtml rendering engine: full support of line numbering,
      regular spaces instead HTML non-breaking spaces
    - docs updated
vim-publish-helper-0.7.tgz 0.7 2014-02-08 7.0 Alexey Radkov     - customizing attributes of HTML tag <pre> using variable g:PhHtmlPreAttrs
    - select between conditions in .vimrc or .vimrc.pandoc using variables
      defined in a new attribute vars (see docs)
vim-publish-helper-0.6.tgz 0.6 2014-01-08 7.0 Alexey Radkov     - all elements that do not have syntax names are highlighted by Normal
      highlighting group
    - HTML may now be rendered using internal plugin's highlighting engine,
      this is controlled by a new variable g:PhHtmlEngine; with the new engine
      line numbering of code blocks gets available
    - added new variable g:PhTrimBlocks to control how blank lines around the
      code will be managed
vim-publish-helper-0.5.tgz 0.5 2014-01-07 7.0 Alexey Radkov     - added new variable g:PhCtrlTrans that deals with correct representation
      of control characters in MakeTexCodeHighlight
vim-publish-helper-0.4.tgz 0.4 2014-01-04 7.0 Alexey Radkov     - fixed white-instead-black foreground issue
    - added example of how to use Shaded and Highlighting environments in docs
    - other small fixes
vim-publish-helper-0.3.tgz 0.3 2014-01-04 7.0 Alexey Radkov     - vimhl.hs: added possibility to load a dedicated file $HOME/.vimrc.pandoc
      instead normal $HOME/.vimrc when running pandoc: this may extremely
      speed up pandoc; see docs for details
    - vimhl.hs: added another option to choose color scheme when running
      pandoc: attribute colorscheme; however using file $HOME/.vimrc.pandoc is
      more preferable
vim-publish-helper-0.2.tgz 0.2 2014-01-02 7.0 Alexey Radkov     - dropped perl dependency in vimhl.hs
    - vimhl.hs is no longer executable script (make it executable or compile)
    - docs added
publish_helper-0.1.tgz 0.1 2014-01-01 7.0 Alexey Radkov Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo