JS추가
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js"></script>
코드추가
$(window).load(function() { $("#content .article pre[class]").each(function() { try{ var lang = String($(this).attr("class")).match(/brush\:([ a-zA-Z_]*)\;?/)[1]; lang = lang.trim().replace(/^js$/i, "javascript"); var editor = ace.edit(this); editor.getSession().setMode("ace/mode/"+ lang); // 언어설정 editor.setTheme("ace/theme/pastel_on_dark"); // 테마설정 editor.setReadOnly(true); // 읽기전용설정 editor.setOptions({ maxLines: 1000 }); // 최대표시행 editor.setShowPrintMargin(false); // 프린터 여백설정 } catch(ex) { console.info (ex); } }); });
설정(테마)
- "chrome": "Chrome DevTools",
- "clouds": "Clouds",
- "clouds_midnight": "Clouds Midnight",
- "cobalt": "Cobalt",
- "crimson_editor": "Crimson Editor",
- "dawn": "Dawn",
- "dreamweaver": "Dreamweaver",
- "eclipse": "Eclipse",
- "github": "GitHub",
- "idle_fingers": "idleFingers",
- "kr_theme": "krTheme",
- "merbivore": "Merbivore",
- "merbivore_soft": "Merbivore Soft",
- "mono_industrial": "monoindustrial",
- "monokai": "Monokai",
- "pastel_on_dark": "Pastels on Dark",
- "solarized_dark": "Solarized-dark",
- "solarized_light": "Solarized-light",
- "katzenmilch": "Katzenmilch",
- "kuroir": "Kuroir Theme",
- "textmate": "Textmate (Mac Classic)",
- "tomorrow": "Tomorrow",
- "tomorrow_night": "Tomorrow-Night",
- "tomorrow_night_blue": "Tomorrow-Night-Blue",
- "tomorrow_night_bright": "Tomorrow-Night-Bright",
- "tomorrow_night_eighties": "Tomorrow-Night-Eighties",
- "twilight": "Twilight",
- "vibrant_ink": "Vibrant Ink",
- "xcode": "Xcode_default"
지원하는 언어
- ABAP: ["abap"],
- ABC: ["abc"],
- ActionScript:["as"],
- ADA: ["ada|adb"],
- Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
- AsciiDoc: ["asciidoc|adoc"],
- ASL: ["dsl|asl"],
- Assembly_x86:["asm|a"],
- AutoHotKey: ["ahk"],
- BatchFile: ["bat|cmd"],
- Bro: ["bro"],
- C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
- C9Search: ["c9search_results"],
- Cirru: ["cirru|cr"],
- Clojure: ["clj|cljs"],
- Cobol: ["CBL|COB"],
- coffee: ["coffee|cf|cson|^Cakefile"],
- ColdFusion: ["cfm"],
- CSharp: ["cs"],
- Csound_Document: ["csd"],
- Csound_Orchestra: ["orc"],
- Csound_Score: ["sco"],
- CSS: ["css"],
- Curly: ["curly"],
- D: ["d|di"],
- Dart: ["dart"],
- Diff: ["diff|patch"],
- Dockerfile: ["^Dockerfile"],
- Dot: ["dot"],
- Drools: ["drl"],
- Edifact: ["edi"],
- Eiffel: ["e|ge"],
- EJS: ["ejs"],
- Elixir: ["ex|exs"],
- Elm: ["elm"],
- Erlang: ["erl|hrl"],
- Forth: ["frt|fs|ldr|fth|4th"],
- Fortran: ["f|f90"],
- FTL: ["ftl"],
- Gcode: ["gcode"],
- Gherkin: ["feature"],
- Gitignore: ["^.gitignore"],
- Glsl: ["glsl|frag|vert"],
- Gobstones: ["gbs"],
- golang: ["go"],
- GraphQLSchema: ["gql"],
- Groovy: ["groovy"],
- HAML: ["haml"],
- Handlebars: ["hbs|handlebars|tpl|mustache"],
- Haskell: ["hs"],
- Haskell_Cabal: ["cabal"],
- haXe: ["hx"],
- Hjson: ["hjson"],
- HTML: ["html|htm|xhtml|vue|we|wpy"],
- HTML_Elixir: ["eex|html.eex"],
- HTML_Ruby: ["erb|rhtml|html.erb"],
- INI: ["ini|conf|cfg|prefs"],
- Io: ["io"],
- Jack: ["jack"],
- Jade: ["jade|pug"],
- Java: ["java"],
- JavaScript: ["js|jsm|jsx"],
- JSON: ["json"],
- JSONiq: ["jq"],
- JSP: ["jsp"],
- JSSM: ["jssm|jssm_state"],
- JSX: ["jsx"],
- Julia: ["jl"],
- Kotlin: ["kt|kts"],
- LaTeX: ["tex|latex|ltx|bib"],
- LESS: ["less"],
- Liquid: ["liquid"],
- Lisp: ["lisp"],
- LiveScript: ["ls"],
- LogiQL: ["logic|lql"],
- LSL: ["lsl"],
- Lua: ["lua"],
- LuaPage: ["lp"],
- Lucene: ["lucene"],
- Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
- Markdown: ["md|markdown"],
- Mask: ["mask"],
- MATLAB: ["matlab"],
- Maze: ["mz"],
- MEL: ["mel"],
- MIXAL: ["mixal"],
- MUSHCode: ["mc|mush"],
- MySQL: ["mysql"],
- Nix: ["nix"],
- NSIS: ["nsi|nsh"],
- ObjectiveC: ["m|mm"],
- OCaml: ["ml|mli"],
- Pascal: ["pas|p"],
- Perl: ["pl|pm"],
- pgSQL: ["pgsql"],
- PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
- Pig: ["pig"],
- Powershell: ["ps1"],
- Praat: ["praat|praatscript|psc|proc"],
- Prolog: ["plg|prolog"],
- Properties: ["properties"],
- Protobuf: ["proto"],
- Python: ["py"],
- R: ["r"],
- Razor: ["cshtml|asp"],
- RDoc: ["Rd"],
- Red: ["red|reds"],
- RHTML: ["Rhtml"],
- RST: ["rst"],
- Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
- Rust: ["rs"],
- SASS: ["sass"],
- SCAD: ["scad"],
- Scala: ["scala"],
- Scheme: ["scm|sm|rkt|oak|scheme"],
- SCSS: ["scss"],
- SH: ["sh|bash|^.bashrc"],
- SJS: ["sjs"],
- Smarty: ["smarty|tpl"],
- snippets: ["snippets"],
- Soy_Template:["soy"],
- Space: ["space"],
- SQL: ["sql"],
- SQLServer: ["sqlserver"],
- Stylus: ["styl|stylus"],
- SVG: ["svg"],
- Swift: ["swift"],
- Tcl: ["tcl"],
- Tex: ["tex"],
- Text: ["txt"],
- Textile: ["textile"],
- Toml: ["toml"],
- TSX: ["tsx"],
- Twig: ["twig|swig"],
- Typescript: ["ts|typescript|str"],
- Vala: ["vala"],
- VBScript: ["vbs|vb"],
- Velocity: ["vm"],
- Verilog: ["v|vh|sv|svh"],
- VHDL: ["vhd|vhdl"],
- Wollok: ["wlk|wpgm|wtest"],
- XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
- XQuery: ["xq"],
- YAML: ["yaml|yml"],
- Django: ["html"]
참조
- https://ace.c9.io
- https://github.com/ajaxorg/ace/wiki/Configuring-Ace
- https://ace.c9.io/tool/mode_creator.html
- https://github.com/ajaxorg/ace/blob/master/lib/ace/ext/modelist.js#L45
'Etc' 카테고리의 다른 글
당근마켓 성장과 개발 스택의 변화 (42 서울테크세미나,2020-05-28) (0) | 2022.05.13 |
---|---|
Xplatform Log Location (Xplatform 로그위치) (0) | 2018.08.27 |
Wacom Intuos (CTL-490) (0) | 2018.05.11 |
우편번호다운로드 (0) | 2018.03.19 |
Base 64 (0) | 2018.03.08 |