Shiki is a beautiful syntax highlighter powered by the same language engine that many code editors use. This package allows you to run Shiki on AWS Lambda through Sidecar.

You can highlight code by calling the \Spatie\SidecarShiki\SidecarShiki::highlight() function. use Spatie\SidecarShiki\SidecarShiki; SidecarShiki::highlight( code: ' ', language: 'php', theme: 'github-light', ); The output is this chunk of HTML rendered through AWS Lambda which will output beautifully in the browser: Marking lines as highlighted, added, deleted or focus use Spatie\SidecarShiki\SidecarShiki; // Highlighting lines 1 and 4,5,6 SidecarShiki::highlight( code: $code, language: 'php', highlightLines: [1, '4-6'], ); // Marking line 1 as added SidecarShiki::highlight( code: $code, language: 'php', addLines: , ); // Marking line 1 as deleted SidecarShiki::highlight( code: $code, language: 'php', deleteLines: , ); // Marking line 1 as focus SidecarShiki::highlight( code: $code, language: 'php', focusLines: , ); Using the Commonmark HighlightCodeExtension Here's how we can create a function that can convert Markdown to HTML with all code snippets highlighted.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners