MediaWiki syntax highlighting with Vim
From FVue
Contents
Problem
I want to show my code in MediaWiki with syntax highlighting.
Solution
Online
Install the Vim MediaWiki Syntax highlighting extension.
Offline
Follow this procedure:
- Load the code in Vim
- Issue these Vim commands:
:syntax on " Make sure syntax highlighting is enabled :set nonumber " Disable possible line numbering :colorscheme default " Use the default colors :runtime! syntax/2html.vim " Convert to HTML (or from gVim menu: {Syntax | Convert to HTML}) :%s/<br>$// " Remove
's at end of line
- Manually remove possible generated HTML-links which have been generated out of http:// links in code.
- Within the resulting HTML file, indent the contents of the
<body>
block with one space. - Copy the contents of the
<body>
block to MediaWiki. Leave out the outer 'monospace' definition.
See also
- VIM Color Scheme Test
- 284 Vim color scheme examples on one page
Journal
20070916
Found Vim syntax highlighing extension in MediaWiki subversion repository.
20071006
Tried setting a different color scheme, e.g. `pablo':
$/var/lib/mediawiki-1.11.0/extensions/SyntaxHighlight_vim> cat vimrc.vim syntax on set encoding=utf8 set uc=0 " Disable swap files set background=dark colorscheme pablo
but it appears all gui colors are converted to the standard set of 16 non-gui terminal colors.
You can use css by specifying in vimrc.vim
:
let html_use_css=1
Advertisement