andyp 9 1 марта, 2016 Опубликовано 1 марта, 2016 · Жалоба Нельзя ли прикрутить раскраску кода для matlab/c++/c ? Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
megajohn 3 1 марта, 2016 Опубликовано 1 марта, 2016 · Жалоба до сих пор *.cpp *.c нельзя прикреплять, так что до раскраски еще огого Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
andyp 9 23 мая, 2016 Опубликовано 23 мая, 2016 · Жалоба Локально прикрутил раскраску с помощью greasemonkey, google prettifier и следующего скрипта // ==UserScript== // @name Elecronix code prettifier // @match *://electronix.ru/forum/* // @version 1 // @grant none // ==/UserScript== // google prettify highlighting script var HLJS = "//cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=matlab&skin=sunburst"; (function() { 'use strict'; // Don't run inside iframes (Looking at you GreaseMonkey + TinyMCE) if (window.top !== window.self) return; // Runs a function in the document. Basically like a Content Script. // http://wiki.greasespot.net/Content_Script_Injection function contentEval(source) { // Check for function input. if ('function' == typeof source) { // Execute this function with no arguments, by adding parentheses. // One set around the function, required for valid syntax, and a // second empty set calls the surrounded function. source = '(' + source + ')();' } // Create a script node holding this source code. var script = document.createElement('script'); script.setAttribute("type", "application/javascript"); script.textContent = source; // Insert the script node into the page, so it will run, and immediately // remove it to clean up. document.body.appendChild(script); //document.body.removeChild(script); } // Given a src attribute, makes a <script> tag into the end of <body> function contentScript(source) { var tag = document.createElement('script'); tag.setAttribute('type', 'application/javascript'); tag.src = source; document.body.appendChild(tag); //document.body.removeChild(tag); return tag; } var ds = document.getElementsByClassName('codemain'); while(ds.length) { var old_elem = ds[0]; var new_elem = document.createElement('pre'); new_elem.innerHTML = old_elem.innerHTML; new_elem.className = 'prettyprint'; old_elem.parentNode.replaceChild(new_elem, old_elem); } var hl = contentScript(HLJS); })(); Выглядит как-то так: Матлаб иногда глючит: как переключать скины написано тут: https://github.com/google/code-prettify/blo...ting_started.md Если есть спецы по js, то буду рад любым замечаниям по улучшению. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
SNB 0 23 мая, 2016 Опубликовано 23 мая, 2016 · Жалоба Нельзя ли прикрутить раскраску кода для matlab/c++/c ? В смысле "раскраску"? Синтаксическую подсветку что ли? Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
andyp 9 23 мая, 2016 Опубликовано 23 мая, 2016 · Жалоба В смысле "раскраску"? Синтаксическую подсветку что ли? Ну да. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться