Pre tags
-
In this[^] post, the color formatting has a couple of issues, such as strings not closing properly and comments not in a different color. Also, I had to change the < to < (and > ) manually for the links and the divs, even though they were within pre tags.
If at first you don't succeed, you're not Chuck Norris.
-
In this[^] post, the color formatting has a couple of issues, such as strings not closing properly and comments not in a different color. Also, I had to change the < to < (and > ) manually for the links and the divs, even though they were within pre tags.
If at first you don't succeed, you're not Chuck Norris.
I agree that the syntax colorizer has problems (I've noted that problem in the past). However, the pre tag is a different story... The pre tag is not supposed to escape inequality symbols. It preserves spaces and line breaks. To encode inequality symbols automatically, click the "Encode HTML tags when pasting" option below new messages.
There will be a line break after this sentence because pre does not escape inequality symbols.
See?If I select the aformentioned option to encode HTML tags, copy the above pre tag in its entirety (i.e., including its content), then paste it and surround it with pre tags again, I get the following:
<pre lang="text">There will be a line break after this sentence because pre does not escape inequality symbols.<br />See?</pre>
Visual Studio is an excellent GUIIDE.
-
I agree that the syntax colorizer has problems (I've noted that problem in the past). However, the pre tag is a different story... The pre tag is not supposed to escape inequality symbols. It preserves spaces and line breaks. To encode inequality symbols automatically, click the "Encode HTML tags when pasting" option below new messages.
There will be a line break after this sentence because pre does not escape inequality symbols.
See?If I select the aformentioned option to encode HTML tags, copy the above pre tag in its entirety (i.e., including its content), then paste it and surround it with pre tags again, I get the following:
<pre lang="text">There will be a line break after this sentence because pre does not escape inequality symbols.<br />See?</pre>
Visual Studio is an excellent GUIIDE.
I believe you missed my point. pre tags are used on this site to show code in messages. My point is that if you paste code directly into the pre tags (such as html) then the editor should automatically escape it, without the need to select "Do not interpret HTML tags (good for code snippets)". Like when a url is pasted into the editor it automatically adds the link etc.
If at first you don't succeed, you're not Chuck Norris.
-
I believe you missed my point. pre tags are used on this site to show code in messages. My point is that if you paste code directly into the pre tags (such as html) then the editor should automatically escape it, without the need to select "Do not interpret HTML tags (good for code snippets)". Like when a url is pasted into the editor it automatically adds the link etc.
If at first you don't succeed, you're not Chuck Norris.
I tend to agree with you, for several reasons: 1. it would be more comfortable when code can simply be copied in VS and pasted in CP without having to worry about some checkboxes hidden underneath the edit window; 2. it would reduce the number of unreadable messages, where people did it wrong and never notice; a lot of questions about generics are completely lost right now; 3. it would be more consistent with other editors and HTML viewers. The official reply seems to be people want the ability to have some HTML formatting going on inside PRE blocks; as an example, <b> is often considered useful to highlight the line where something goes wrong. Therefore my suggestion has been to get automatic escaping of whatever gets pasted inside PRE tags, leaving the possibility to apply internal HTML tags once everything got pasted in. As a refinement, the automatic escape logic could (optionally) skip a limited set of tags, such as <b> :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
-
I tend to agree with you, for several reasons: 1. it would be more comfortable when code can simply be copied in VS and pasted in CP without having to worry about some checkboxes hidden underneath the edit window; 2. it would reduce the number of unreadable messages, where people did it wrong and never notice; a lot of questions about generics are completely lost right now; 3. it would be more consistent with other editors and HTML viewers. The official reply seems to be people want the ability to have some HTML formatting going on inside PRE blocks; as an example, <b> is often considered useful to highlight the line where something goes wrong. Therefore my suggestion has been to get automatic escaping of whatever gets pasted inside PRE tags, leaving the possibility to apply internal HTML tags once everything got pasted in. As a refinement, the automatic escape logic could (optionally) skip a limited set of tags, such as <b> :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
What if we simply used a WYSIWYG editor?
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
What if we simply used a WYSIWYG editor?
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
Can you expand on that? If you are referring to the article submission wizard, I had a hell of a time getting my TextFileDiff article look the way I wanted; it has some PRE blocks showing code and others showing app output (which includes HTML stuff from your test files). It took me 4 iterations to get all the < signs right in both code and HTML output; times two, as I did one revision which started with removing everything and pasting my source again. (And I should do another revision, but am not looking forward to that right now). In my experience WYSIWYG is never the full answer. Just like a GUI-only app isn't complete (I tend to need command line "extensions" to WinZip, which are available as a separate install!) We always need some copy-and-paste facilities, making copying code from IDE to publication (and vice versa) easy. And when formatting capabilities are present, they should be encoded somehow, so we can copy the full source (text+formatting) in and out too (I would accept explicit export and import functions for that). So what is it you have in mind? :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
-
Can you expand on that? If you are referring to the article submission wizard, I had a hell of a time getting my TextFileDiff article look the way I wanted; it has some PRE blocks showing code and others showing app output (which includes HTML stuff from your test files). It took me 4 iterations to get all the < signs right in both code and HTML output; times two, as I did one revision which started with removing everything and pasting my source again. (And I should do another revision, but am not looking forward to that right now). In my experience WYSIWYG is never the full answer. Just like a GUI-only app isn't complete (I tend to need command line "extensions" to WinZip, which are available as a separate install!) We always need some copy-and-paste facilities, making copying code from IDE to publication (and vice versa) easy. And when formatting capabilities are present, they should be encoded somehow, so we can copy the full source (text+formatting) in and out too (I would accept explicit export and import functions for that). So what is it you have in mind? :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
The article submission wizard and then the new Quick Answers system.
Luc Pattyn wrote:
It took me 4 iterations to get all the < signs right in both code and HTML output
Were you in Design mode or raw HTML mode? Can you give me an example of the type of text/code you were pasting and what you were trying to achieve? Everyone does everything slightly differently and the WYSIWYG editor works really, really well for me, but obviously because I wrestled it into submission for myself. Then again, I never use Winzip from a command line (ah, those were the days...)
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
The article submission wizard and then the new Quick Answers system.
Luc Pattyn wrote:
It took me 4 iterations to get all the < signs right in both code and HTML output
Were you in Design mode or raw HTML mode? Can you give me an example of the type of text/code you were pasting and what you were trying to achieve? Everyone does everything slightly differently and the WYSIWYG editor works really, really well for me, but obviously because I wrestled it into submission for myself. Then again, I never use Winzip from a command line (ah, those were the days...)
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
The examples are in here[^]. I copied the lot from my HTML file (which looked exactly the way I wanted it in FF3, given a preamble with some elementary styles) and pasted it into the wizards editor. Don't recall what mode it started of in; it took me a while to discover it has two modes, it does not tell, nor does it tell which mode it is in. I do recall it behaved differently for code (with an occasional < in a for loop) and HTML-tagged text data; it felt like a bug but I never was able to put my finger on it, otherwise I would have reported it. BTW1: why is it the WYSIWYG editor has a lot of functionality that becomes unavailable in source mode? e.g. I would like to be able to search for something in the source. And a find-and-replace would have eased things a bit (so I could turn all & into & or the other way around). BTW2: the current Q&A seems to have three modes: two in Edit, one in Preview. Not sure I understand that either. Is preview identical to WYSIWYG, except it also is read-only? If it were really WYSIWYG why would I still need a preview? PS: I need command line interfaces for automation, e.g. batch files creating ZIP files. That is how I create the download packages for my articles, and much more. :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
-
The examples are in here[^]. I copied the lot from my HTML file (which looked exactly the way I wanted it in FF3, given a preamble with some elementary styles) and pasted it into the wizards editor. Don't recall what mode it started of in; it took me a while to discover it has two modes, it does not tell, nor does it tell which mode it is in. I do recall it behaved differently for code (with an occasional < in a for loop) and HTML-tagged text data; it felt like a bug but I never was able to put my finger on it, otherwise I would have reported it. BTW1: why is it the WYSIWYG editor has a lot of functionality that becomes unavailable in source mode? e.g. I would like to be able to search for something in the source. And a find-and-replace would have eased things a bit (so I could turn all & into & or the other way around). BTW2: the current Q&A seems to have three modes: two in Edit, one in Preview. Not sure I understand that either. Is preview identical to WYSIWYG, except it also is read-only? If it were really WYSIWYG why would I still need a preview? PS: I need command line interfaces for automation, e.g. batch files creating ZIP files. That is how I create the download packages for my articles, and much more. :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
Luc Pattyn wrote:
it took me a while to discover it has two modes, it does not tell, nor does it tell which mode it is in
In design mode you are editing WYSIWYG. It should be very, very obvious that you have formatted text, images, layout etc. In source mode you see plain text in Courier New and lots of HTML tags. It's the usual HTML mess. BTW1: Some things we get for free in WYSIWYG mode because browsers give it to us. Some of these things are hard to implement within HTML mode. Some things we simply haven't implemented. BTW2: In Q&A yes, there is WYSIWYG, Edit and preview. Preview gives you a final sanity check and will colourise code snippets.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP