flytekitplugins.deck.SourceCodeRenderer#

class flytekitplugins.deck.SourceCodeRenderer(title='Source Code')#

Convert Python source code to HTML, and return HTML as a unicode string.

Methods

Parameters:

title (str)

to_html(source_code)#

Convert the provided Python source code into HTML format using Pygments library.

This method applies a colorful style and replaces the color “#fff0f0” with “#ffffff” in CSS.

Parameters:

source_code (str) – The Python source code to be converted.

Returns:

The resulting HTML as a string, including CSS and highlighted source code.

Return type:

str