Coder Social home page Coder Social logo

Comments (5)

Caffe1neAdd1ct avatar Caffe1neAdd1ct commented on July 20, 2024

Ok think i've tracked this one down. By checking out and opening the CodeMirror repo mode php index.html example and looking at the required javascript files I can see the following files are dependencies of the php highlighting:

codemirror.js
matchbrackets.js
htmlmixed.js
xml.js
javascript.js
css.js
clike.js
php.js

matchbrackets.js was missed when using the http://codemirror.net/doc/compress.html utility.

I'll recompile and submit a pull request when i get 5 minutes ๐Ÿ‘

from wikitten.

Caffe1neAdd1ct avatar Caffe1neAdd1ct commented on July 20, 2024

Got all the modes working for all libraries using the following build process:

## Clone CodeMirror repo
git clone [email protected]:codemirror/CodeMirror.git
cd CodeMirror

## Make a tmp workspace
mkdir -p _all/_files
mkdir -p _all/_deps

## Copy in main lib
cd _all
cp ../lib/codemirror.js .
cp ../lib/codemirror.css .

## Copy in all modes for syntax highlighting
cd _files
cp ../../mode/*/*.js .

## Locate test files
grep -i "MT(" *

## Remove test files
rm -rf less_test.js scss_test.js test.js

## Copy in deps for some of the modes
cd ../_deps/
cp ../../addon/edit/matchbrackets.js .
cp ../../addon/mode/simple.js .

## Combine all addons and modes with main lib file
cat *.js >> ../codemirror.js
cd ../_files
cat *.js >> ../codemirror.js

## Copy to Wikitten project
cp ../codemirror.js ../../../Wikitten/static/js/codemirror.min.js
cp ../codemirror.css ../../../Wikitten/static/css/codemirror.css

Pulls in the two deps matchbrackets.js and simple.js used by many of the modes for highlighting helpers.

Build output:

 ~/Software ๎‚ฐ git clone [email protected]:codemirror/CodeMirror.git
Cloning into 'CodeMirror'...
remote: Counting objects: 28054, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 28054 (delta 19), reused 2 (delta 2), pack-reused 28005
Receiving objects: 100% (28054/28054), 13.88 MiB | 1.83 MiB/s, done.
Resolving deltas: 100% (16377/16377), done.
Checking connectivity... done.
 ~/Software ๎‚ฐ cd CodeMirror
 ~/Software/CodeMirror ๎‚ฐ ๎‚  master ๎‚ฐ mkdir -p _all/_files
 ~/Software/CodeMirror ๎‚ฐ ๎‚  master ๎‚ฐ mkdir -p _all/_deps
 ~/Software/CodeMirror ๎‚ฐ ๎‚  master ๎‚ฐ cd _all
 ~/Software/CodeMirror/_all ๎‚ฐ ๎‚  master ๎‚ฐ cp ../lib/codemirror.js .
 ~/Software/CodeMirror/_all ๎‚ฐ ๎‚  master ๎‚ฐ cp ../lib/codemirror.css .
 ~/Software/CodeMirror/_all ๎‚ฐ ๎‚  master ๎‚ฐ cd _files
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ cp ../../mode/*/*.js .
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/css/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/gfm/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/haml/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/javascript/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/markdown/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/php/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/ruby/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/shell/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/slim/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/stex/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/textile/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/verilog/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/xml/test.jsโ€™
cp: will not overwrite just-created โ€˜./test.jsโ€™ with โ€˜../../mode/xquery/test.jsโ€™
 โœ˜ ๎‚ฐ ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ grep -i "MT(" *
less_test.js:  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); }
less_test.js:  MT("variable",
less_test.js:  MT("amp",
less_test.js:  MT("mixin",
less_test.js:  MT("nest",
less_test.js:  MT("interpolation", ".@{[variable foo]} { [property font-weight]: [atom bold]; }");
scss_test.js:  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
scss_test.js:  MT('url_with_quotation',
scss_test.js:  MT('url_with_double_quotes',
scss_test.js:  MT('url_with_single_quotes',
scss_test.js:  MT('string',
scss_test.js:  MT('important_keyword',
scss_test.js:  MT('variable',
scss_test.js:  MT('variable_as_attribute',
scss_test.js:  MT('numbers',
scss_test.js:  MT('number_percentage',
scss_test.js:  MT('selector',
scss_test.js:  MT('singleline_comment',
scss_test.js:  MT('multiline_comment',
scss_test.js:  MT('attribute_with_hyphen',
scss_test.js:  MT('string_after_attribute',
scss_test.js:  MT('directives',
scss_test.js:  MT('basic_structure',
scss_test.js:  MT('nested_structure',
scss_test.js:  MT('mixin',
scss_test.js:  MT('number_without_semicolon',
scss_test.js:  MT('atom_in_nested_block',
scss_test.js:  MT('interpolation_in_property',
scss_test.js:  MT('interpolation_in_selector',
scss_test.js:  MT('interpolation_error',
scss_test.js:  MT("divide_operator",
scss_test.js:  MT('nested_structure_with_id_selector',
scss_test.js:  MT('indent_mixin',
scss_test.js:  MT('indent_nested',
scss_test.js:  MT('indent_parentheses',
scss_test.js:  MT('indent_vardef',
test.js:  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
test.js:  MT("indent",
test.js:  MT("indent_switch",
test.js:  MT("def",
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ rm -rf less_test.js scss_test.js test.js
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ cd ../_deps/
 ~/Software/CodeMirror/_all/_deps ๎‚ฐ ๎‚  master ๎‚ฐ cp ../../addon/edit/matchbrackets.js .
 ~/Software/CodeMirror/_all/_deps ๎‚ฐ ๎‚  master ๎‚ฐ cp ../../addon/mode/simple.js .
 ~/Software/CodeMirror/_all/_deps ๎‚ฐ ๎‚  master ๎‚ฐ cat *.js >> ../codemirror.js
 ~/Software/CodeMirror/_all/_deps ๎‚ฐ ๎‚  master ๎‚ฐ cd ../_files
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ cat *.js >> ../codemirror.js
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ cp ../codemirror.js ../../../Wikitten/static/js/codemirror.min.js
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ cp ../codemirror.css ../../../Wikitten/static/css/codemirror.css
 ~/Software/CodeMirror/_all/_files ๎‚ฐ ๎‚  master ๎‚ฐ 

Now there are no errors in the console:
screenshot from 2015-05-29 15 09 21

and syntax highlighting seems to be working for php and other languages ๐Ÿ‘

from wikitten.

Caffe1neAdd1ct avatar Caffe1neAdd1ct commented on July 20, 2024

Lastly minifying locally and not relying on a web based compiler:

## Install uglify-js
sudo npm install uglify-js -g

## Run the minifier
uglifyjs --compress --mangle --output test.js -- Wikitten/static/js/codemirror.min.js

## Copy resulting file into the project
cd Wikitten/static/js
mv codemirror.min.js codemirror.js
cp ../../../test.js codemirror.min.js

from wikitten.

Caffe1neAdd1ct avatar Caffe1neAdd1ct commented on July 20, 2024

One pull request to fix: #63

from wikitten.

victorstanciu avatar victorstanciu commented on July 20, 2024

I merged PR #63, thank you!

from wikitten.

Related Issues (20)

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.