Converts a JSON or JavaScript string to HTML with inline CSS color styling Convenience function that parses the string and paints it as HTML
The string to convert to HTML (JSON or JavaScript literal)
Optional
Optional configuration for highlighting
HTML string with span tags and inline CSS styles
const json = '{"name": "Alice", "age": 30}';const html = html_from_string(json);document.body.innerHTML = html; Copy
const json = '{"name": "Alice", "age": 30}';const html = html_from_string(json);document.body.innerHTML = html;
const arr = '[1, 2, 3, "hello", true]';const html = html_from_string(arr, { palette: palettes.bold.dark });console.log(html); // Outputs HTML with inline styles Copy
const arr = '[1, 2, 3, "hello", true]';const html = html_from_string(arr, { palette: palettes.bold.dark });console.log(html); // Outputs HTML with inline styles
Converts a JSON or JavaScript string to HTML with inline CSS color styling Convenience function that parses the string and paints it as HTML