syntax-highlighting

Prism HTML highlighter

戏子无情 提交于 2019-11-30 00:50:23
问题 I'm using Prism and its working well for CSS: <pre><code class="language-css">p { color: red }</code></pre> but i can't get it working for html: <pre><code class="language-html"><p class="red">red text</p></code></pre> I have 2 problems: < and > are represented as tags, not as text, but i could replace it by < and > More important, even replaced as shown in problem 1, the highliter will not highlight any code and everything is just black. Despite that it is working for CSS, whole code looks

Trouble using Vim's syn-include and syn-region to embed syntax highlighting

安稳与你 提交于 2019-11-30 00:38:44
I am trying to get Vim to syntax highlight any file that ends with extension .Rtex in the following way: All top level text is highlighted as TeX Exception: any text enclosed in \begin{python}...\end{python} is highlighted as Python I am able to achieve each of these criteria individually, but unable to achieve both simultaneously. I think that somehow the TeX highlighting overrides my Python-highlighted regions, or prevents them from taking effect, and I am stuck trying to figure out how. First step: edit .vimrc to give files with extension .Rtex the filetype rtex : au BufRead *.Rtex setf

c# - perfect syntax highlighting [closed]

我们两清 提交于 2019-11-30 00:23:27
I'm looking for a RichTextBox with syntax highlighting! Sounds easy but I'm searching since months and didn't find that what I need. First I started to do it by myself... No good idea... I tried to use this: http://blogs.microsoft.co.il/blogs/tamir/archive/2006/12/14/RichTextBox-syntax-highlighting.aspx but that code don't handle loading files or pasting so i started to write a highlight function for inserting text-blocks. That tutorial and my code worked fine first, but then I saw a lot of tiny bugs and loading large files took too much time. Then a found a lot of similar tutorials/codes at

How Is Syntax Highlighting Built?

陌路散爱 提交于 2019-11-30 00:13:30
问题 I'm now building a developers editor using Lazarus and as every good developers editor, it needs to have a syntax highlighting, because of this that I want to know some things: How is syntax highlight normally built(using many if s to change the font on a TextField ? TSynEdit is very nice to do this? How to use TSynEdit (links and resources)? 回答1: You can actually see an excellent example for yourself if you look at the editor for SharpDevelop. It's implemented in C# but uses great OOP that

Syntax Highlighting in Cocoa TextView? Experiences? Suggestions? Ideas? [duplicate]

删除回忆录丶 提交于 2019-11-29 22:40:34
Possible Duplicate: Syntax coloring for Cocoa app I'm interested in syntax highlighting in a Cocoa TextView. I found several resources: approach with flex , via a flex pattern matched against textStorageDidProcessEditing in a TextView delegate. In this approach the whole string get parsed on each input event, hence performance degrades. CocoaDev has an own page on the topic of syntax highlighting : Use NSTextStorageDidProcessEditingNotification , then get the edited range, and just apply the coloring there. The range might be wordboundaries or anything; this definitely improves performance.

How to tell BeautifulSoup to extract the content of a specific tag as text? (without touching it)

柔情痞子 提交于 2019-11-29 22:31:03
问题 I need to parse an html document which contains "code" tags I'm getting the code blocks like this: soup = BeautifulSoup(str(content)) code_blocks = soup.findAll('code') The problem is, if i have a code tag like this: <code class="csharp"> List<Person> persons = new List<Person>(); </code> BeautifulSoup forse the closing of nested tags and transform the code block into: <code class="csharp"> List<person> persons = new List</person><person>(); </person> </code> is there any way to extract the

Writing a syntax highlighter

て烟熏妆下的殇ゞ 提交于 2019-11-29 21:34:52
I was hoping to write my own syntax highlighter for a summer project I am thinking of working on but I am not sure how to write my own syntax highlighter. I know that there are bunch of implementations out there but I would like to learn about regular expressions and how syntax highlighting works. How does syntax highlighting work and what are some good references for developing one? Does the syntax highlighter scan each character as it is typed or does it scan the document/text area as a whole after each character is typed? Any insight would be greatly appreciated. Thanks. PS: I was planning

How can I highlight multiple lines with Ace?

吃可爱长大的小学妹 提交于 2019-11-29 21:16:11
问题 The old method mentioned in similar questions here is the following: var editor = ace.edit("editor"); var Range = ace.require('ace/range').Range; editor.setReadOnly(true); editor.setTheme("ace/theme/github"); editor.getSession().setMode("ace/mode/javascript"); editor.getSession().addMarker(new Range(1, 0, 15, 0), "ace_active_line", "background"); Unfortunately it doesn't work, as you can see here: http://jsbin.com/acotuv/1/edit Any suggestions? 回答1: seems like signature of the addMarker

Sublime Bracket Highlighter not coloring brackets

南笙酒味 提交于 2019-11-29 21:03:59
For me Bracket Highlighter plugin is not coloring and highlighting brackets but just underlining them in white. Here is a snapshot: Anyone knows of a solution? AGS Edit your ~/Library/Application Support/Sublime Text 2/Packages/BracketHighlighter/bh_core.sublime-settings And set "style" to "highlight" for each bracket type you want highlighted. Here is an example for curly brackets. // User defined region styles "curly": { "icon": "curly_bracket", "color": "entity.name.class", "style": "highlight" } lawlist I have modified my example based upon the comments of AGS - it now includes a couple of

Enabling Liquid templating syntax highlight in webStorm/phpStorm

≡放荡痞女 提交于 2019-11-29 21:03:36
I wonder if someone managed to enable the Liquid templating engine syntax highlighting in WebStorm IDE , I work a lot on Shopify stores and really like using Webstorm for that purpose. Did anyone managed to get this working? I found some resources regarding this issue on JetBrain's forum though it didn't quite got me anywhere, there is one dude who suggested using ' tmBundle ' and that might work if you do some dark magic. The thread is: RUBY-7210 and the official plugin request: JetBrain's plugins: Liquid Templating language request Ilia luk I've found out that Twig have a very similar syntax