Is there an easy wy to allow users to submit a code block?

October 21, 2017 3:22pm

Subscribe [2]
  • #1 / Oct 21, 2017 3:22pm

    Bill the Grue's avatar

    Bill the Grue

    159 posts

    Hello all

    I would like to allow my users to submit a block of code from a front-end form. I want the submission to respect whitespace, tabs, and all the various characters one might find in a code block. Extra points if a user can choose which language so syntax highlighting might work.

    I’m hoping for something like this:

    Any ideas?

    Thank you in advance



  • #2 / Oct 25, 2017 10:56am

    Derek Jones's avatar

    Derek Jones

    7378 posts

    Sure thing, Bill! Mentioned it in Slack, but posting here for Google-ability. You can use bbcode-like code blocks, and specify the syntax grammar to use for highlighting purposes. This works great with drop-in highlighters like highlight.js but you have options! See the docs section: Syntax Highlighting.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases