code-input

Code-input: Plugins

List Of Plugins

๐Ÿ’ก Do you just want to get a quick editor working? We suggest the Indent and Prism Line Numbers plugins.

Lots of plugins are very customisable - please see the JavaScript files for parameters and if you want more features let us know via GitHub Issues.


Auto-Close Brackets

Automatically close pairs of brackets/quotes/other syntaxes in code, but also optionally choose the brackets this is activated for.

Files: auto-close-brackets.js

๐Ÿš€ CodePen Demo

Autocomplete

Display a popup under the caret using the text in the code-input element. This works well with autocomplete suggestions.

Files: autocomplete.js / autocomplete.css

๐Ÿš€ CodePen Demo

Autodetect

Autodetect the language live and change the lang attribute using the syntax highlighterโ€™s autodetect capabilities. Works with highlight.js.

Files: autodetect.js

๐Ÿš€ CodePen Demo

Find and Replace

Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default, or when JavaScript triggers it) functionality to the code editor.

Files: find-and-replace.js / find-and-replace.css

๐Ÿš€ CodePen Demo

Go To Line

Add a feature to go to a specific line when a line number is given (or column as well, in the format line no:column no) that appears when (optionally) Ctrl+G is pressed or when JavaScript triggers it.

Files: go-to-line.js / go-to-line.css

๐Ÿš€ CodePen Demo

Indent

Add indentation using the Tab key, and auto-indents after a newline, as well as making it possible to indent/unindent multiple lines using Tab/Shift+Tab. Supports tab characters and custom numbers of spaces as indentation, as well as (optionally) brackets typed affecting indentation.

Files: indent.js

๐Ÿš€ CodePen Demo

Prism Line Numbers

Allow code-input elements to be used with the Prism.js line-numbers plugin, as long as the code-input element or a parent element of it has the CSS class line-numbers. Prism.js Plugin Docs

Files: prism-line-numbers.css (NO JS FILE)

๐Ÿš€ CodePen Demo

Special Chars

Render special characters and control characters as a symbol with their hex code.

Files: special-chars.js / special-chars.css

๐Ÿš€ CodePen Demo

Using Plugins

Plugins allow you to add extra features to a template, like automatic indentation or support for highlight.jsโ€™s language autodetection. To use them, just: