Skip to content

aels/code-edit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code-Edit

image

What does it do?

Turn any textarea tag into syntax-highlighted code editor with 1 line of code. Code-Edit lets you turn any ordinary JavaScript syntax-highlighting theme and program into customisable syntax-highlighted textareas using an HTML <textarea> element. It uses vanilla CSS to superimpose a textarea, then handles indentations, scrolling and fixes any resulting bugs with JavaScript.

What are the advantages of using Code-Edit, and what can it be used for?

Unlike other front-end code-editor projects, the simplicity of how Code-Edit works means it is highly customisable. As it is not a full-featured editor, you can choose what features you want it to include, and use your favourite syntax-highlighting algorithms and themes. Also, key value is that Code-Edit saves original textarea with all event listners on it, so all your scripts will continue to work as before.

Getting Started With Code-Edit

Code-Edit is designed to be both easy to use and customisable. Here's how to use it to create syntax-highlighted textareas:

  • Just import only one JS file of Code-Edit from a downloaded release or a CDN.
    <!--In the <footer> -->
    <script src="//cdn.jsdelivr.net/gh/aels/[email protected]/code-input.min.js#//highlightjs.org/static/demo/styles/monokai-sublime.css"></script>
  • Take attention. Your theme is passed via # after js script url. If it is missed, default theme will be used.
  • That's All, enjoy =)

About

Turn any textarea tag into syntax-highlighted code editor with one script tag

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%