highlightDCode

Takes a piece of D code and outputs a sequence of HTML elements useful for syntax highlighting.

The output will contain <span> elements with the class attribute set to the kind of entity that it contains. The class names are kept compatible with the ones used for Google's prettify library: "typ", "kwd", "com", "str", "lit", "pun", "pln", "spc"

The only addition is "spc", which denotes a special token sequence starting with a "#", such as "#line" or "#!/bin/sh".

Note that this function will only perform actual syntax highlighting if the libdparse package is available as a DUB dependency.

void main(string[] args)
{
	#line 2
	import std.stdio; // yeah
	writefln("Hello, "~"World!");
	Package pack;
	ddox.entities.Module mod;
}
  1. void highlightDCode(R dst, string code, IdentifierRenderCallback ident_render)
  2. string highlightDCode(string str, IdentifierRenderCallback ident_render)
    string
    highlightDCode

Parameters

ident_render IdentifierRenderCallback

Optional delegate to customize how (qualified) identifiers are rendered

Meta