Click here to Skip to main content
14,691,233 members
Articles » General Reading » CodeProject FAQs » General
Tip/Trick
Posted 10 Jun 2010

Tagged as

Stats

59.6K views
19 bookmarked

Formatting Code in Tips and Tricks

Rate me:
Please Sign up or sign in to vote.
4.98/5 (27 votes)
8 Apr 2013CPOL
Syntax coloring for tip/trick

Code in tip/trick posts should be wrapped with <pre> </pre> tags to ensure formatting and colouring are correct.

For example:

<pre lang = "vb">
' Example  
Dim test As String
</pre>

will produce:

' Example
Dim test As String

To specify the programming language, use lang="xxx" as follows:

<pre lang = "C++"> for native C++ formatting
<pre lang = "mc++"> for C++/CLI formatting
<pre lang = "aspnet"> for ASP.NET formatting
<pre lang = "cs"> for C# formatting
<pre lang = "css"> for CSS formatting
<pre lang = "F#"> for F# formatting
<pre lang = "html"> for HTML formatting
<pre lang = "Java"> for Java formatting
<pre lang = "jscript"> for JavaScript formatting
<pre lang = "asm"> for MASM/ASM formatting
<pre lang = "msil"> for MSIL formatting
<pre lang = "midl"> for MIDL formatting
<pre lang = "php"> for PHP formatting
<pre lang = "sql"> for SQL formatting
<pre lang = "vbscript"> for VBScript formatting
<pre lang = "xml"> for XML formatting

If you want to enter text like <pre lang = "xml">:

  1. Check the allow HTML radio button in the Tip/Trick editor "When Pasting" option list. Use the article editor to enter text. Copy its HTML and paste here.
  2. Learn the special text for symbols like <(&-lt-; Remove the - for the symbol)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Anshul R
Student
India India
No Biography provided

Comments and Discussions

 
GeneralFDG Pin
Pawan Pandey (P.P)31-Oct-13 8:38
MemberPawan Pandey (P.P)31-Oct-13 8:38 
QuestionThis is not working Pin
MuhtarQong11-Feb-13 9:28
MemberMuhtarQong11-Feb-13 9:28 
GeneralReason for my vote 5 Pin
D-Kishore3-Sep-12 20:56
MemberD-Kishore3-Sep-12 20:56 
GeneralReason for my vote of 5 very helpful while we post some tips... Pin
Nikhil_S15-Feb-12 1:03
professionalNikhil_S15-Feb-12 1:03 
Generalwhen & where can i edit a question submitted by someone else... Pin
anushripatil10-Jan-12 19:20
Memberanushripatil10-Jan-12 19:20 
GeneralReason for my vote of 5 Thx Pin
Pranit Kothari3-Jan-12 16:22
MemberPranit Kothari3-Jan-12 16:22 
GeneralReason for my vote of 5 usefull one Pin
Rupesh Kumar Tiwari26-Sep-11 6:23
MemberRupesh Kumar Tiwari26-Sep-11 6:23 
GeneralReason for my vote of 1 feeeeeeee Pin
aaditya bhargava bansi17-Jul-11 4:00
Memberaaditya bhargava bansi17-Jul-11 4:00 
GeneralReason for my vote of 5 Really useful!! Pin
Shao Voon Wong10-Feb-11 23:50
mvaShao Voon Wong10-Feb-11 23:50 
GeneralReason for my vote of 5 Good one Pin
TweakBird11-Dec-10 5:05
MemberTweakBird11-Dec-10 5:05 
GeneralTwo things: this information is already included in the arti... Pin
knockNrod14-Sep-10 7:18
MemberknockNrod14-Sep-10 7:18 
GeneralOne problem... Pin
Steve Wellens4-Sep-10 14:33
MemberSteve Wellens4-Sep-10 14:33 
GeneralRe: One problem... Pin
Steve Wellens28-Nov-10 4:47
MemberSteve Wellens28-Nov-10 4:47 
GeneralRe: One problem... Pin
Anshul R29-Nov-10 1:26
MemberAnshul R29-Nov-10 1:26 
SuggestionRe: One problem... Pin
Shahan Ayyub24-Mar-13 6:03
MemberShahan Ayyub24-Mar-13 6:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.