ASP.NET Editable Text Box with Syntax Highlighting - asp.net

Here's what I'm trying to do. I'm looking for a WYSIWYG editor or just a plain text-box that will highlight HTML syntax (in ASP.NET). Basically, we have a CMS that allows you to mess with templates for various pages, but right now all of the editable HTML is in a plain, ugly, text box. Does anyone know of an editor that will highlight the synax and allow you to edit it? I've checked out Antipro SyntaxEditor, which seems to be a good highlighting solution, but it's just a highlighter, and not an editor.
Thanks!

You may need to combine tools. For example, SO combines Markdown with Google Prettify which handles the actual syntax highlighting.

Another option is CKeditor and they offer open source licensing.

I use FreeTextBox on my dasBlog site. It seems to work pretty well and has the capabilities you're asking for.
Update
Hmm... the version on my own site has a button the toolbar to do syntax highlighting, but that button isn't shown on any the demos available at the link I have gave you. Just know that it does work, but that you may have to play with the configuration some to get that working.

Related

How to disable syntax highlighting in Atom.io

Is there a way to disable syntax highlighting in Atom.io?
I have searched a bit and ended up creating my own syntax package (https://atom.io/themes/no-syntax-highlighting-syntax), but maybe there is a better way.
NB: I just want to disable syntax highlighting (ideally keeping only comments and code in a different color), but I still want the other language-related features of Atom.io working. Like language completions, language snippets, language closure/bloc detections, auto-indent, etc.
(Some people argues against syntax highlighting, stating it might be actually harmful to developer productivity. I wanted to try that. Ie. http://www.linusakesson.net/programming/syntaxhighlighting/ and https://www.robertmelton.com/2016/03/21/syntax-highlighting-off/)
You can use Ctrl+Shift+L (or press button bottom right) to select proper language. In your case it would be Plain Text.
Second option is install package https://atom.io/packages/file-types and add in config.cson:
'file-types':
'YOURS EXTENSION': 'text.plain'
Haven't found a better solution yet.
If you are trying to do the same thing as I was - disabling syntax highlighting in Atom.io while keeping comments differentiated, language completions, language snippets, language closure/bloc detections and auto-indent - I would just recommend to install the theme I've created: https://atom.io/themes/no-syntax-highlighting-syntax
Set the file syntax to plain text. You can do this with control alt L or something like that.

Is there any HTML wysiwyg editor?

I wonder whether there is any good WYSIWYG editor when it comes to editing complex HTML pages generated from ASP.NET, PHP, GWT or anything else. I've tried a lot of WYSIWYG tools, but after a certain point I always end up with manually editing the HTML source code or CSS to fix different issues. The editors I've tried are never compatible with the ASP.NET/PHP/etc code I'm writing.
Edit: I have used Visual Studio for a few years to do ASP.NET development. After a while, it always comes to the point where I can't even open the pages and user controls because they rely on so many things which aren't available in debug time.
You're not going to get anything that is perfect. You're almost always going to have to tweak the mark-up by hand at least a little bit.
Your best bet would probably be Adobe Dreamweaver for PHP and Visual Studio (Visual Studio Web Developer Express is free) for ASP.NET.
I love VS, but I'd rather make sweet love to a hedgehog than use the HTML editor. Expression Web does a much better job editing HTML.
Personally I think that Visual Studio is the best for ASP.NET, although Expression Web also seems to be pretty good.
But I personally I think it's the best for you to start writing more code and using the WYSIWYG part less and less.
With Web applications it's all about the way they're displayed in the browser and I think that the browser is the tool which should be used for testing the GUI.
I agree, I have Expression Web right now and it works well. You can move stuff around in design view but will of course, as stated above, have to render the code manually. But it works if you wanna see the changes you have made. I would always of course view it in the browser and not just rely on the design view. Also W3Schools is a great tool.
WYSIWYG editors for complex web site/applications just never measure up IMHO.
The problem comes down to wanting control of the HTML/CSS markup, yet also the flexibility to create a GUI via drag-n-drop. (the 2 are almost polar opposites)
Take a very simple example.
In WYSIWYG mode, I type/create (pretend that World is on the line right after Hello (the Markdown editor forces me to add an extra line break)):
Hello
World
What HTML should the editor create?
Hello<br/>
<b>World</b>
<p>Hello</p>
<p><strong>World</strong></p>
<div>Hello</div>
<div><span style="font-weight:bold;">World</span></div>
<span class="abcNormal">Hello</span>
<br/>
<span class="abcBold">World</span>
(and a zillion more possibilities)
I still think the best thing you can have is an editor/IDE that understands your component/tags and provides auto-completion and code-assist/intellisense - paired up with a very quick deploy option to test changes ASAP in real browser(s)
Take a look at BBCode Editor
http://richtexteditor.com/demo/bbcode.aspx
This example shows a simple BBCode formatter for the Editor.

how to show code snippet on ASP.NET page with color formatting

I want to show code in asp.net page , how to show code snippet that it will look in same colors as it looks in visual studio , best examlple i can give is this stackoverflow.com itself we can put code fragment in our question which looks well colored giving better user exprience
i have just no clue ? also how to store code snippets when user enters them ?
You probably want to start with Google Prettify which is the same code coloring tool used here on Stack Overflow.
StackOverflow uses Prettify for syntax highlighting.
What do you mean by how to store code snippets? You might want to post that as a separate question with a little more detail.
The solution you're looking for is called syntax highlighting.
Prettify is a popular one, but I've used SyntaxHighlighter before and it is quite nice.
SyntaxHighlighter helps developers to
display code on their website.
Also, Syntax Highlighter recently added a hosted syntax highlighter "service."
About Syntax Highlighter
Hosted Version of Syntax Highlighter
Extra: Shanselman Speaks on Syntax Highlighting

ASP.NET code formatting tool

Is there any tool for Visual Studio 2008 which can reformat ASPX code to make it more presentable (eg insert line breaks, format the lines so they wrap when necessary, etc)?
Thanks
Have you tried hitting Ctrl+K+D? Is this what you're referring to?
http://blogs.msdn.com/markhsch/archive/2008/01/10/visual-studio-tip-autoformat-your-code.aspx
To have Visual Studio fix it all up nice and tidy for you, select the text, hold CTRL and hit K followed by F (CTRL+K-F). What I usually do is do a CTRL-A to select all text then do the CTRL+K-F combo. Voila!
You can also do it from the menu Edit > Advanced > Format Document or toolbar.
alt text http://img148.imageshack.us/img148/8872/formatdoc2.png
There are actually a number of tools dedicated to code formatting that you might want to take a look at. Visual Studio's formatting capabilities are actually quite limited, and a lot of projects I have worked on use one of these external tools.
Good luck!
This may not be directly related to your issue, but DevExpress has a free product CodeRush Express that will not only help with tidying but has a great interface for refactoring. Here is a link to their demo video. I've used their products for a few years and they really up your productivity.
After 11 years there is still no tool that does it right. All online formatters I found dont cope well with ASP (.NET/Core/Blazor) tags, and VS20xx (even the latest 2022) doesn't deal with tags from custom controls, it formats all, except for sections within custom tags. In my case, 90% of the aspx files.

Style a code snippet with css

Could someone give me a link, a tutorial or an already made css template for styling code snippet to add that feature to my blog ?
I seen examples in numerous blogs, but, now that i am searching for one, i can't put hands on it !
I want to be able to post a code snippet with keyword coloration, line numbers etc..
Many thanks in advance.
EDIT : i know there are some solution like prettify (thanks Developer Art) or SyntaxHighliter but i am on a platform and i can't use Javascript
Prettify is what you're looking for.
You include a bunch of JavaScript and CSS files to your pages and mark page sections that need to be prettified. Pretty much it.
manoli.net offers an online copy/paste syntax highlighter:
This tool allows you to format your
C#, VB, HTML, XML, T-SQL or MSH (code
name Monad) code for publishing on a
web site or in a blog.
The output conforms to the HTML 4.01
specification and is color-coded to
make it easier to read. The colors can
be changed by modifying the CSS style
sheet. See a sample.
And you may want to check out the Syntax Highlighter project on CodePlex (not sure how much activity it still has, though):
Syntax highlighter converts code text
to HTML where common language elements
are formatted using style sheet
classes such that the coloring scheme
can be switched or altered as simple
as replacing a CSS file. The primary
release ships as an extension for
BlogEngine.NET.
There are server side solutions for this as well, which of course depend on your server language. PHP is the ever popular choice for blogs, in which case you could use the equally popular GeSHi library.

Resources