Adds browser behavior to HTML rendered from Lynkow content, accessible via
lynkow.enhancements: copy buttons on code blocks, inline script execution,
height sync for embedded Lynkow widgets, and CSS that keeps inline text
alignment. The client starts it in the browser, and it also enhances content
added later. Every method is a no-op on the server.
Restyle code blocks by overriding the --lynkow-code-* CSS custom
properties. A light class or data-theme="light" on <html> selects the
light variant.
Access via: lynkow.enhancements
Methods
3 methods
destroy
destroy(): voidStops every enhancement and removes the styles and script copies the
service added to <head>. Safe to call repeatedly, and init() starts
the enhancements again.
Returns: void
useEffect(() => {
lynkow.enhancements.init()
return () => lynkow.enhancements.destroy()
}, [])init
init(options: EnhancementsInitOptions): voidStarts the enhancements on the page and on content added later. The client
calls it in the browser just after createClient() returns. Later calls do
nothing until destroy(), so to change the options after startup call
destroy(), then init(options).
Parameter | Type | Description |
|---|---|---|
|
|
|
Returns: void
// Your own highlighter renders code blocks.
lynkow.enhancements.destroy()
lynkow.enhancements.init({ codeBlocks: false })isInitialized
isInitialized(): booleanReturns true once init() has run, until destroy(). Always false on
the server.
Returns: boolean
if (!lynkow.enhancements.isInitialized()) {
lynkow.enhancements.init()
}