annotations.js

by David Capello

Show snippets of your favorite language converting comments to pretty annotations.

From this:

var str = "Hi people"; // Prints "people" console.log(str.slice(3, 9)); //^ The second argument is the end, not length

to this:

var str = "Hi people"; // Prints "people" console.log(str.slice(3, 9)); //^ The second argument is the end, not length

Test your code

#include <stdio.h> // Needed for printf() function /* Your program starts here */ int main() { printf("Hello World

"); // Prints "Hello World" return 0; //^ Zero means no error }

Download

Get annotations.js, it needs prettify.

Install

<html> <head> ... <link href="prettify.css" rel="stylesheet"> <link href="annotations.css" rel="stylesheet"> </head> <body> <pre class="prettyprint"> ... </pre> <script src="prettify.js" type="text/javascript"></script> <script src="annotations.js" type="text/javascript"></script> <!-- Prettify your code and then your annotations --> <script type="text/javascript"> PR.prettyPrint(); prettyAnnotations(); </script> </body> </html>