Phiki::codeToHtml() method.
- The code you want to highlight as a
string. - The grammar (or language) of the code.
- The theme you want to use for highlighting.
Styling
Phiki applies all of its styling using inlinestyle attributes, so there’s no need to add any CSS to your project to get started.
However, you may want to add some basic styles to the <pre> element that Phiki generates to improve the overall appearance of code blocks. Here is a sample CSS snippet you can use:
Gutter
By default, Phiki does not include a gutter (line numbers) in the generated HTML. However, you can enable it by calling thewithGutter() method on the result of codeToHtml().
editorLineNumber.foreground styles provided by your chosen theme, but you can override these styles using CSS.
Changing the starting line number
If you wish to change the starting line number from the default of1, you can use the startingLine() method.
5, the second line 6, and so on.