GithubHelp home page GithubHelp logo

abhikumar427 / codeflask.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kazzkiq/codeflask

0.0 2.0 0.0 6.21 MB

A micro code-editor for awesome web pages.

CSS 13.30% JavaScript 75.59% HTML 11.11%

codeflask.js's Introduction

CodeFlask.js

A micro code-editor for awesome web pages.

About

CodeFlask.js was made as an attempt to create a leaner code editor for simple purposes. Just a few lines of code and you're ready to play with code on your browser.

If you want a robust web code editor you can check projects that aim that big, such as CodeMirror.

Usage

In order to use CodeFlask.js you need also import Prism.js (for code highlight) into your project. Prism basically uses two files, an .js file and an .css one (where you can theme the code syntax).

After importing Prism, you will need two files from CodeFlask.js also. They are the codeflask.js and codeflask.css. Both are really small and only with the necessarily to make everything work properly.

Example:

...
<head>
  <link rel="stylesheet" href="prism.min.css">
  <link rel="stylesheet" href="codeflask.css">
  <script src="prism.min.js"></script>
  <script src="codeflask.js"></script>
</head>

Notice that prism.min.js must be declared before codeflask.js, as CodeFlask.js have dependency on the first.
Obs.: It is recomended to declare JavaScript files at the end of your <body> tag, the above example is just for ease of understanding purposes.

After that, all you need to do is to define an element where your editor should be rendered, and call it on JavaScript:

...
<body>
  <div class="my-code-wrapper" data-language="javascript"></div>
  
  <script>
    CodeFlask.run('.my-code-wrapper');
  </script>
</body>

Few things to consider:

  • You can render one or multiple editors at once, e.g.: CodeFlask.run('#lone-editor') or CodeFlask.run('.my-editors');
  • You can specify an default language for all editors, e.g.: CodeFlask.run('.my-editors', 'javascript').
  • If you don't specify the attribute data-language or an default language for all editors, by default CodeFlask will render your editor as markup (HTML).

Credits & Thanks

Made in Rio.

CodeFlask.js was made possible and have dependency on Prism.js by Lea Verou.

codeflask.js's People

Contributors

kazzkiq avatar

Watchers

Abhishek Kumar avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.