code_mobject

Mobject representing highlighted source code listings.

Classes

Code

A highlighted source code listing.

Functions

hilite_me(code, language, style, insert_line_no, divstyles, file_path, line_no_from)[source]

Function to highlight code from string to html.

Parameters
  • code (str) – Code string.

  • language (str) – The name of the programming language the given code was written in.

  • style (str) – Code style name.

  • insert_line_no (bool) – Defines whether line numbers should be inserted in the html file.

  • divstyles (str) – Some html css styles.

  • file_path (str) – Path of code file.

  • line_no_from (int) – Defines the first line’s number in the line count.

insert_line_numbers_in_html(html, line_no_from)[source]

Function that inserts line numbers in the highlighted HTML code.

Parameters
  • html (str) – html string of highlighted code.

  • line_no_from (int) – Defines the first line’s number in the line count.

Returns

The generated html string with having line numbers.

Return type

str