Angular2 & Atom - Using Question Mark Syntax '?' in HTML causes HTML tag discoloration - html

I'm not sure if this is the right place for this question but there seems to be an atom-editor tag and none of the related questions I've have been removed so here goes.
When I use the Safe Navigation / Null Property Operator (?.) it messing up the rest of my html
But this is what I mean
Before
After
This makes it harder on the eyes when I use question marks and I'd like to be able to use them without the discoloration of the everything below the ?'s
I assume the issues lies with one of the following:
My Syntax Theme
I'm using the Lucario Theme in the example and tried changing it out with other themes but this doesn't seem to be the issue.
The atom package language-html
I think this is the issue because it seems to be the part of Atom that supports the HTML Language it's self. I thought this could be corrected in the Non Word Characters option
so I tried the default above and tried removing the ? from Non Word Characters option like
But it didn't work and I also restarted atom to make sure but nothing seems to work.
Any tips, suggestions or fixes for my problem?
Thanks

Related

MediaWiki VisualEditor textcolor

I'm trying to extend the VisualEditor by adding custom functionality.
It was pretty easy to add stuff which is realized with a single HTML-tag without parameters. But now I try to add textcolor. I tried to replicate the LanguageAnnotation as that's pretty similar (using span lang=.. while I want span style=color:..).
But it looks like there are a lot more things which I have to change here & I don't understand.
I'd be very grateful for any kind of help here.
Edit: To provide more information: Currently I am trying to replicate the .toDomElements function which I struggle with because I can not find the place where to modify the exact tag syntax (style instead of lang).
Well, I'm not sure if it's the best possible solution, but I've managed this problem by replicating the LanguageAnnotatation, including the widget-system (I chose it because it was the closest one to what I wanted to accomplish as it uses CSS and the span-tag).
I've replicated the following classes, adjusting the attributes (language has lang and dir attributes, my color-annotation only the color attribute):
ve.ce.TextColorAnnotation.js
ve.dm.TextColorAnnotation.js
ve.ui.TextColorContextItem.js
ve.ui.TextColorSearchDialog.js
ve.ui.TextColorInspector.js
ve.ui.TextColorInspectorTool.js
ve.ui.TextColorSearchWidget.js
ve.ui.TextColorInputWidget.js
ve.ui.TextColorResultWidget.js
It works pretty good imo. The only problem I see right now (and which I am working on next) is that with this implementation, text (or background)-color can only be applied to text, but not to tables (only when marking the text inside a cell).

Changing colorschemes in vim disables syntax highlighting for html

So yeah, the question is in the title. The situation is that, imaging one vim window split into one half of html and the other half css. When I change the colorscheme from say Badwolf to molokai, the syntax coloring on the html disappears. Any reasons why?
When I change the colorscheme it seems that only html filetypes is affected (as css syntax highlighting is still present), and most colorschemes don't highlight the syntax. examples include molokai, monokai, etc with exceptions being badwolf and gruvbox.
Do you guys think this is a bug or is there something wrong with my _vimrc? Really don't wanna go through 100+ lines of code all neatly folded last night :(

Can Vim highlight matching HTML tags like Notepad++?

Vim has support for matching pairs of curly brackets, parentheses, and square brackets. This is great for editing C-style languages like PHP and JavaScript. But what about matching HTML tags?
Notepad++ has had this feature for as long as I’ve been using it. Being able to spot where blocks of HTML begin and end is very useful. What I’m looking for is something like this for Vim (see the green div tags):
A bonus feature: highlighting unclosed HTML tags, like the red tag in the above screenshot.
matchit has been proposed as the next-best-thing, but it requires an extra keystroke to use its functionality. I’d like be able to see where the blocks of HTML begin and end without an extra keypress.
I’ve trawled the internet to find something like this for Vim. Apparently, I’m not the only one, according to two other StackOverflow questions and a Nabble thread.
I’ve almost resigned myself to Vim not being able to visually match HTML tags. Is it possible for Vim to do this?
Addendum: If it is not currently possible to do this with any existing plugins, does any Vimscript wizard out there have any pointers on how to approach writing a suitable plugin?
I had to work with some HTML today so thought I would tackle this. Added a ftplugin to vim.org that should solve your problem.
You can get it here on vim.org.
You can get it here on github.
Hope it works for you. Let me know if you have any problems.
Greg's MatchTag.vim plugin is awesome, but I wanted something more. I wanted the enclosing tags to always be highlighted, not just when the cursor is on one of the tags.
So I wrote MatchTagAlways which does everything that Greg's MatchTag does and also always highlights the enclosing tag, no matter where the cursor is in the code. It also works with unclosed tags and HTML templating languages like Jinja or Handlebars.
Here's a GIF showing it in action:
I came here looking for matching html style angle brackets in Vim. This seems to work:
:set mps+=<:>
:help matchpairs

Is there a html validator that can point to a mismatches like this?

Occasionally press a hyphen so the first symbol in a html file (php generated) was not a tag start, but a general symbol. Firefox didn't care about it (it was a joomla source), but IE acted like I did something more dangerous: not centered table, misaligned text, looked like a complete mess. I know that there are always things like this, but I wasted a couple of hours to figure out what was going on. Is there a html validator that can point to things like this?
Thanks
Total Validator would flag it with This element is not recognised.
Most validators will do that.
Try the w3c validator. I tried a valid file with a symbol at the start and it flagged it.

Rails - Escaping HTML using the h() AND excluding specific tags

I was wondering, and was as of yet, unable to find any answers online, how to accomplish the following.
Let's say I have a string that contains the following:
my_string = "Hello, I am a string."
(in the preview window I see that this is actually formatting in BOLD and ITALIC instead of showing the "strong" and "i" tags)
Now, I would like to make this secure, using the html_escape() (or h()) method/function.
So I'd like to prevent users from inserting any javascript and/or stylesheets, however, I do still want to have the word "Hello" shown in bold, and the word "string" shown in italic.
As far as I can see, the h() method does not take any additional arguments, other than the piece of text itself.
Is there a way to escape only certain html tags, instead of all? Like either White or Black listing tags?
Example of what this might look like, of what I'm trying to say would be:
h(my_string, :except => [:strong, :i]) # => so basically, escape everything, but leave "strong" and "i" tags alone, do not escape these.
Is there any method or way I could accomplish this?
Thanks in advance!
Excluding specific tags is actually pretty hard problem. Especially the script tag can be inserted in very many different ways - detecting them all is very tricky.
If at all possible, don't implement this yourself.
Use the white list plugin or a modified version of it . It's superp!
You can have a look Sanitize as well(Seems better, never tried it though).
Have you considered using RedCloth or BlueCloth instead of actually allowing HTML? These methods provide quite a bit of formatting options and manage parsing for you.
Edit 1: I found this message when browsing around for how to remove HTML using RedCloth, might be of some use. Also, this page shows you how version 2.0.5 allows you to remove HTML. Can't seem to find any newer information, but a forum post found a vulnerability. Hopefully it has been fixed since that was from 2006, but I can't seem to find a RedCloth manual or documentation...
I would second Sanitize for removing HTML tags. It works really well. It removes everything by default and you can specify a whitelist for tags you want to allow.
Preventing XSS attacks is serious business, follow hrnt's and consider that there is probably an order of magnitude more exploits than that possible due to obscure browser quirks. Although html_escape will lock things down pretty tightly, I think it's a mistake to use anything homegrown for this type of thing. You simply need more eyeballs and peer review for any kind of robustness guarantee.
I'm the in the process of evaluating sanitize vs XssTerminate at the moment. I prefer the xss_terminate approach for it's robustness—scrubbing at the model level will be quite reliable in a regular Rails app where all user input goes through ActiveRecord, but Nokogiri and specifically Loofah seem to be a little more peformant, more actively maintained, and definitely more flexible and Ruby-ish.
Update I've just implemented a fork of ActsAsTextiled called ActsAsSanitiled that uses Santize (which has recently been updated to use nokogiri by the way) to guarantee safety and well-formedness of the RedCloth output, all without needing any helpers in your templates.