Skip to content

V01dDweller/vim2html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vim2html

The problem: Quickly converting an ASCII file with color escapes to html via the cli or bash scripts.

Initially, ansi2html was the solution and, while it is really well done, a fixed-width/mono-spaced font was needed so things like logs, tables or reports would line up. Unfortunately, most browsers render html with a variable-width font by default and ansi2html has no obvious way to change that.

Fortunately, Vim comes bundled with a plug-in, 2html.vim, (See the TOhtml command) which uses <PRE>. When combined with AnsiEsc - another plug-in that is not bundled with Vim - and a tiny bash script, it solves the problem nicely.

This will overwrite files without warning, use at your own risk!

Installation

  1. Install AnsiEsc
  2. Copy these to a directory in your PATH. e.g. ~/bin, $HOME/bin, etc..

Usage:

  1. vansi2html - Converting ANSI with color escapes:

    $ vanis2html foo.txt
    
    Created foo.txt.html
    
  2. vsyntax2html - Save Vim's syntax highlighted output to html:

    $ vsyntax2html foo.java
    
    Created foo.java.html
    

About

Super short bash scripts that invoke vim and the TOhtml plugin to create HTML

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages