Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hi guys,

do you have any recommendations of how to best implement the display of code-snippets (e.g. HTML- or CSS-Code)? I want the WYSIWYG-Editor to handle all the inputs for the code-snippets and then display them properly in the frontend. To take it one step further, I want the snippets to be able to be copied (with the click of a single button/link) like Strg+C from the frontend.

Do you have anny suggestions of how to realize that with couch?

Thank you very much and kind regards,
madtrigger
Hi, this is usually handled via JS syntax highlighter library (there are a few!). Here is an example with a button to copy code blocks https://prismjs.com/plugins/toolbar/

PHP also has a function for that e.g. https://www.php.net/manual/en/function. ... t-file.php in case this has to be generated server-side (to render an email body, for instance).

Couch-wise, a textarea editable field with param 'no_xss_check' should be fine to keep code blocks without changes → example: viewtopic.php?f=4&t=12860#p36507
2 posts Page 1 of 1
cron