Click here to Skip to main content
15,881,600 members
Articles / Programming Languages / C#
Tip/Trick

Using the Article Editor (without losing your hair in handfuls)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (20 votes)
17 Jun 2014CPOL4 min read 32K   11   12   18
The Article editor does work - but sometimes it does do things the hard way, and tries to frustrate you on purpose, I'm sure...

Having trouble writing or posting articles? These articles aim to gather together tips and tricks from authors and mentors to help you write great articles.

Introduction

I've been writing stuff here for a while, and every time I do it I end up spending more time faffing about and swearing at the Article Editor than I do actually writing text: and my major problem is getting code samples into the document as code blocks. So lets start by looking at that.

Code blocks

It just hates me, I'm sure.

Let's try: Copy some code from your application, and paste it in:

        /// <summary>
        /// Human readable version
        /// </summary>
        /// <returns></returns>
        public override string ToString()
            {
            return Title + " : " + Path.GetFileName(OldPath);
            }

Nope. not right. This version is better than the last Editor, but it isn't quite right: look at it in the Preview and you'll see:

Image 1

What we want is:

C#
/// <summary>
/// Human readable version
/// </summary>
/// <returns></returns>
public override string ToString()
    {
    return Title + " : " + Path.GetFileName(OldPath);
    }

Fortunately, that isn't as hard to do as it was - in the previous version I ended up switching to HTML mode, pasting the code, then manually adding the <pre> tags:

<pre lang="cs">        /// <summary>
        /// Human readable version
        /// </summary>
        /// <returns></returns>
        public override string ToString()
            {
            return Title + " : " + Path.GetFileName(OldPath);
            }</pre>

Which was clumsy, and a nightmare if you forgot and pasted it into the text, as it applied the code formatter information, but not the code block - and to fix that you had to manually remove all the span tags it had added...and it normally ate all the VS Intellisense parts in comments, sicne they looked like HTML tags to it... :sigh:

This version is easy:

1) Paste the code:

        /// <summary>
        /// Human readable version
        /// </summary>
        /// <returns></returns>
        public override string ToString()
            {
            return Title + " : " + Path.GetFileName(OldPath);
            }

2) Highlight it:

Image 23) Go to the toolbar, and click the "Remove Format" button (strictly, you don't have to do this, but just in case:

Image 34) Highlight the code again, and use "Paragraph Format" dropdown to select "Formatted":

Image 4Image 5Image 65) Use the "Language" drop down to select the appropriate language highlighter:

Image 7Image 8Image 9

6) Now, your code looks like this:

Image 10

And in the preview it looks like this:

Image 11Which is what we wanted.

Images

You noticed the images, yes? They are really easy to insert, particularly if you have DropBox installed on your PC. If you do, then whenever you take a screenshot, it is automatically saved to the Dropbox/Screenshots folder for you, so you don't even need a Paint program to include screenshots. Handy...

If you don't have dropbox:

This is more cumbersome: Take the screen shot using the ALT and PRINTSCREEN buttons, and paste it into a new image in your paint program (I use Paint Shop Pro 9 which causes it's own problems, since it disables Aero for compatability, so I have to keep opening and closing it to get consistant looking images). ALT and PRINTSCREEN copys the current window, so if you re-size it to just what you want, you are ready.

Save the file.

If you do have drop box.

Use the ALT and PRINTSCREEN buttons to save the current window. This saves the current window as is, so if you re-size it to just what you want, your file is ready.

Add it to your "Current Files" list:

Easy way: Drag the files from the folder and drop them on the "Target":

Image 12This adds them to the "Current Files" list, so all you have to do is place the cursor where you want the image, and click the "Insert image into article" button:

Image 13

Done!

Adding a download

Start by creating a ZIP file of your project, then upload it to CodeProject and insert it into your document.

The process for this is the same as for an image: use the "Upload Files" box on the right hand side of the screen:Image 14

Except this time you get a "special" insert area at the top of the list:Image 15

Make sure the checkbox is ticked - it is by default - and click on "Add selected zip files to article"

This creates the download link in it's normal position at the top of the article:Image 16

History

2014-06-17 Original Version

2014-06-17

  • Typo corrected: "teh" became "the".
  • Heading corrected on "History" section.

2016-05-28

  • Download added (for download adding demo only)
  • Section added on providing a download.

License

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


Written By
CEO
Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?

Comments and Discussions

 
GeneralMy vote of 5 Pin
Member 150787161-Jul-22 11:13
Member 150787161-Jul-22 11:13 
GeneralRe: My vote of 5 Pin
OriginalGriff2-Jul-22 4:29
mveOriginalGriff2-Jul-22 4:29 
GeneralMy vote of 5 Pin
Mahsa Hassankashi11-Jul-17 14:25
Mahsa Hassankashi11-Jul-17 14:25 
GeneralMy vote of 5 Pin
Wendelius30-Sep-16 22:05
mentorWendelius30-Sep-16 22:05 
QuestionBlog Post fetched via feeds Pin
Ehsan Sajjad8-Oct-15 8:28
professionalEhsan Sajjad8-Oct-15 8:28 
AnswerRe: Blog Post fetched via feeds Pin
OriginalGriff8-Oct-15 8:44
mveOriginalGriff8-Oct-15 8:44 
GeneralMy vote of 5 Pin
Anurag Gandhi27-Jan-15 22:22
professionalAnurag Gandhi27-Jan-15 22:22 
BugIronically... Pin
Matt T Heffron17-Jun-14 14:06
professionalMatt T Heffron17-Jun-14 14:06 
GeneralRe: Ironically... Pin
_Noctis_12-Aug-14 14:44
professional_Noctis_12-Aug-14 14:44 
GeneralRe: Ironically... Pin
OriginalGriff12-Aug-14 18:46
mveOriginalGriff12-Aug-14 18:46 
GeneralRe: Ironically... Pin
_Noctis_12-Aug-14 19:06
professional_Noctis_12-Aug-14 19:06 
GeneralRe: Ironically... Pin
OriginalGriff12-Aug-14 20:19
mveOriginalGriff12-Aug-14 20:19 
GeneralRe: Ironically... Pin
_Noctis_12-Aug-14 21:36
professional_Noctis_12-Aug-14 21:36 
GeneralRe: Ironically... Pin
den2k884-Dec-14 0:49
professionalden2k884-Dec-14 0:49 
GeneralMy vote of 5 Pin
phil.o17-Jun-14 4:22
professionalphil.o17-Jun-14 4:22 
QuestionFormatting Pin
Kenneth Haugland17-Jun-14 1:00
mvaKenneth Haugland17-Jun-14 1:00 
AnswerRe: Formatting Pin
Pete O'Hanlon17-Jun-14 4:20
mvePete O'Hanlon17-Jun-14 4:20 
GeneralRe: Formatting Pin
Kenneth Haugland17-Jun-14 4:31
mvaKenneth Haugland17-Jun-14 4:31 

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.