Using Htmlfontify

If you are currently using Emacs, a really neat treak to convert code to HTML with the syntax highlighting you are currently using is with the command html-fontify.

Enter the current buffer that you want to have the source as html. After that you simple run htmlfontify-buffer. And the current file will be passed to html. For example if I have a simple hello world in C++.

#include <iostream>
using namespace std;
int main(void) {
cout << "Hello World" << endl;
return 0;
}

Running the command makes it way prettier.

#include <iostream> 

using namespace std;

int main(void) {

  cout << "Hello World" << endl;

  return 0;
}

This function uses the current theme running in Emacs.

A cool thing about this is that it automatically converts brackets. So you can show html pretty easily.

<p>Hi! This is an example</p>

Back to articles