Which HTML editor will validate whether I have correctly or incorrectly used for example block level elements in an inline element? - text-editor

I know for example that I cannot use block level elements such as p or h1 in an inline element such as DT. Is there an editor that will warn me or notify me if I am have incorrectly nested my elements?

Visual Studio will do this nicely, but I suspect if you had that you'd already know :)

Related

How exactly does Syntax Highlighting work in IDEs?

I was writing my own text editor in Electron using React and I tried to do some basic syntax highlighting. The user writes their code inside a textarea, but there is no way to insert markup inside a textarea so I can't color text that way.
I found this jquery plugin which adds a backdrop behind the textarea so we can put a background color in certain places however I wanted the text themselves to be colored (which can't be done as the textarea is in front of the backdrop).
Any ideas about how other IDEs like Visual Studio Code (also written in electron) pulled this off?
There are multiple approaches that can work here.
One way could be using a div with a contenteditable="true" attribute instead of a textarea. This way you can both write text inside the element and style its contents. Of course this creates its own issues that would have to be dealt with - when to parse the code, how to reposition the caret and more. Depending on the approach, MutationObserver could come in handy.
Another way would be to not use any built-in writing functionalities at all and implement your own. Listen to keyboard events and programatically insert characters. In that case you would also need to implement your own caret, selection etc., which is not easy.
VS Code is open source, so you can actually take a look under the hood and see how the editor is made. They use a completely bespoke editor called Monaco but its source code is in the VS Code repo. This file is a good start.

Android studio just downloaded and gives an error

I have a problem with android studio. I just downloaded and when I try to add something the app for example a button or text I get the following error:
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with designtime attributes (such as layout_editor_absoluteX). These attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor. To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections.
Well I haven't actually done anything... Download it and instantly error...
After research I found that in the Layouts tab there is an option called ConstraintLayout. I double clicked on it and then I added the button and a warning appeared named hardcoded text and it says:
Hardcoded string "TextView", should use #string resource Hardcoding text attributes directly in layout files is bad for several reasons: * When creating configuration variations (for example for landscape or portrait)you have to repeat the actual text (and keep it up to date when making changes) * The application cannot be translated to other languages by just adding new translations for existing string resources. There are quickfixes to automatically extract this hardcoded string into a resource lookup.
There is a suggested fix but it wont change anything...
Anyone know what to do or it is just my luck...…………...
Just go to Design Tab and on Layout right-click on the layout you've and select Constraint layout --> Infer Constraints.
If you don't find this tab Infer Constraints then you've another android version so just go to Design Tab and click on the button you added you'll find a toolbar appeared you'll find in it an icon for a Magic Stick just hover on it you will find it's Infer Constraints click on it.

AvalonEdit: How to make it right-to-left?

I'm trying to make the avalonedit right-to-left layout, so that supporting languages that are right-to-left (e.g. Arabic)
The code seems to be too large to be understood, I need at least to know where my changes would be? What are main modules of it, or some diagrams/docs clarifying each component (other than the 4 images provided with the source)
I need at least to know what are the basic components of an editor. Thank you for help
The TextView class is responsible for the actual text rendering. The layout within text lines is done using the WPF TextFormatter (see #region BuildVisualLine in TextView.cs).
AvalonEdit already supports bidirectional text within a left-to-right paragraph, so the editor should work if you can get WPF to create right-to-left paragraphs.
I think it might be sufficient to change the VisualLineTextParagraphProperties.FlowDirection property.
Ideally the text view would use the value of TextView.FlowDirection for this, but I've seen some weird effects when using TextView.FlowDirection (text being mirrored). Not sure what's up with that; I'm not familiar with the way WPF works in a right-to-left context (I guess there's some auto-mirroring feature?).

Wrap tables in div with CKEditor in Drupal textarea input

I'm working in Drupal, got CKEditor set up and have the tables plugin going on. The design I'm working with requires some visual elements that would be made A LOT easier if I had a div with a class wrapped around the tables in the output (because tables can't have padding on their sides in IE)...
SO.. I'm can think of 2 ways to do it, but don't know and can't figure out how to do either:
1)Use CKEditor to wrap all table elemnts in a div with a class..
2)Use Drupal input filter to wrap all table elements in a div with a class..
Does anyone know how to do either?
I don't want to add the div on page load.. that would cause a jump, and depend on javascript for the output.
This seems promising: How to find and replace text in CKEditor using Javascript? but is it reliable? It seems kinda hackish and if a non-dev type is going be using the Editor it has to be 100% foolproof..
thanks!

Color a string in Textmate?

is it possible to display a certain string in Textmate in a custom color?
Lets say I want to display the string "myCoolFunction()" always in yellow so I can see better where I use the function in my documents.
Actually it was possible. I modified the language pack. I am working with JavaScript so I edited the JavaScript language pack in TextMate. You have to create a new scope selector with a simple regex. After that you can create a new color rule in the settings and there you have it.
No, there aren't any syntax selectors for specific functions.

Resources