CodeBlock.hpp

Wraps a HighlightJS code block.

class CodeBlock : public Element
#include <CodeBlock.hpp>

Use CodeBlock class to easily add code to a web application that is highlighted based on the language used.

Public Functions

inline CodeBlock(const std::string code_block, const std::string lang, const std::string &id = "")

List of all supported languages: https://highlightjs.org/static/demo/

Note

Due to JavaScript callback functions, can only set code for block in constructor.

Parameters:
  • code_block – string of the code to be placed in code block

  • lang – programming language to base syntax highlighting

  • id – the id of the html element for this code block

Private Members

Element code = {to_string("code")}