Comments (6)
Using a simple overlay mode with the HTML mixed mode is probably the easiest way to handle this. See http://codemirror.net/demo/mustache.html for an example of using an overlay.
from codemirror-v1.
Thanks. This might help a lot!
from codemirror-v1.
I'm sure there's a much more elegant way of accomplishing this (not to mention, more features that could be added) ... but here's a very basic liquid overlay: https://gist.github.com/1356686
Just for anyone who hits this page after searching Google for "CodeMirror liquid parser", like I did :)
from codemirror-v1.
Thanks for linking that!
from codemirror-v1.
Hi,
I just extracted the liquid mode we created for our template editor at https://github.com/axtro/codemirror_liquid_mode. It contains a pure liquid mode, and another overlay mode based on htmlmixed.
It also includes code to make the formatting module of CodeMirror2 compatible with the htmlmixedliquid mode, and another extension to comment/decomment liquid code.
You will see that the parser inserts some autocomplete information into the generated tokens. We use this information in our editor to provide intelligent autocompletion based on the type of the next expected token.
Cheers,
Henning
from codemirror-v1.
This all looks helpful, but where I'm confused about is how to I actually use this?
Do I just drop @kylefox 's code, as-is, into my applications javascript files?
Do I need to set change my code that calls the
editor = CodeMirror.fromTextArea(....
same question for @hennk 's approach
FWIW, Im using codemirror in a Rails app to let my users edit their templates using Liquid and HAML or ERB
from codemirror-v1.
Related Issues (20)
- Autocomplete HOT 4
- PHP Parser fails for some comments HOT 1
- C# parser problem with verbatim string HOT 1
- CodeMirror enterMode config param seems to be ignored if height is set. HOT 1
- Implement electric characters HOT 1
- lostundo missing reference in undo.js HOT 1
- Uncaught ReferenceError: lostundo is not defined HOT 1
- rewrite scrollToNode to just insert a node and check its coords if it needs to
- C# parser : bug with operators (fix inside) HOT 1
- this.editor is undefined (codemirror.js row 203) HOT 1
- content does not show HOT 9
- setValue() clears undo history HOT 1
- HTML5 required attribute breaks hack for form submission HOT 6
- Speed up hideLine method HOT 1
- Pressing tab causes entire line to indent HOT 4
- unable to get separate history for multiple instances of codemirror HOT 4
- loadmode plugin does not work over non string modes HOT 1
- codemirror
- Mirror Demes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codemirror-v1.