PHP and HTML Highlighting #130
Labels
No labels
Area-Accessibility
Area-Build
Area-CodeCompletion
Area-Document
Area-Documentation
Area-Editing
Area-Folding
Area-Highlighting
Area-i18n
Area-Indentation
Area-NetFx
Area-Rendering
Area-Search
Area-Snippets
dependencies
duplicate
Feedback Needed
help wanted
invalid
Issue-Bug
Issue-Discussion
Issue-Enhancement
Issue-Performance
Issue-Question
on-hold
Resolution-Answered
Resolution-By Design
Resolution-Duplicate
Resolution-Fixed
Resolution-Won't Fix
Up-for-Grabs
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-icsharpcode/AvalonEdit#130
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Has someone ever tried to Highlighting PHP and HTML Tags in the Editor?
Our programmers often have to handle PHP-Files with contains PHP- and HTML-Code...
I tried making a new xshd merging the PHP and the HTML xshd files. But i don't get it to work right..
Someone has experience with that?
Or maybe can someone explain how the xshd will be interpreted?
What happens when two rules try to colorize text? Will the first or the last be taken?
Example:
<html>
This should be colorized with some HTML color
<?php>
This should be colorized with some PHP color
This should work:
As far as I can see, the rules will be interpreted in document order and the most suitable (i.e. longest match) will be chosen.
In the above example we first import the existing main rulesets of the
HTMLandPHPhighlighting definitions into our main ruleset (HTML) and we create an extra local ruleset for the PHP rules.Then we create a new span that matches
<?phpas begin expression and?>as end expression. Note that the begin and end expressions are evaluated as regular expressions, therefore we have to escape the question marks. We then use the newly created "PHP" ruleset inside the span.It is important that the PHP span highlighting rule comes before any of the HTML rules, so that the highlighting engine picks it up first.
Hope this helps!