1,105,320 Community Members

Code Tags

Member Avatar
Ancient Dragon
Achieved Level 70
27,576 posts since Aug 2005
Reputation Points: 5,231 [?]
Q&As Helped to Solve: 3,028 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

I tried using [code] and [/code] but that doesn't work. I tried using the Code button but that didn't seem to work either (i.e. past code into editor, highlight, then hit the Code button). So how to add code tags?

Member Avatar
deceptikon
Eternally Awesome
4,669 posts since Jan 2012
Reputation Points: 1,339 [?]
Q&As Helped to Solve: 679 [?]
Skill Endorsements: 104 [?]
Administrator
Featured
 
2
 

BBCode no longer works for new posts, it's all Markdown based now. As far as making a code block, it's a matter of indentation (at least 4 spaces). Presently the code button only pastes an example into the editor if there's no text selected. To paste actual code, you would just paste it in, then select the entire block and hit tab or click the code button.

Another option is wrapping your code in ~~~, which will force a code block without the need for indentation.

I recognize that selecting the code to turn it into a code block is awkward, we're working on making the editor more convenient. ;)

I tried using the Code button but that didn't seem to work either (i.e. past code into editor, highlight, then hit the Code button).

I just tested and it appears to work properly. Can you reproduce the problem consistently with all options described above?

Member Avatar
Ancient Dragon
Achieved Level 70
27,576 posts since Aug 2005
Reputation Points: 5,231 [?]
Q&As Helped to Solve: 3,028 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

Oops! It did work. I just have not gotton used to refreshing the browser after doing something. I just now went back to the thread where I was posting and the code tags worked afterall :)

Member Avatar
Ancient Dragon
Achieved Level 70
27,576 posts since Aug 2005
Reputation Points: 5,231 [?]
Q&As Helped to Solve: 3,028 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

Testing

int nTransistors;
char ManID[20];
char Polarity[20];
// populate the above with info now shown here
printf("%d %s %s\n", nTransistors, ManID, Polarity);
Member Avatar
Ancient Dragon
Achieved Level 70
27,576 posts since Aug 2005
Reputation Points: 5,231 [?]
Q&As Helped to Solve: 3,028 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

Yes! Got ~~~ working :)

Member Avatar
Dani
The Queen of DaniWeb
20,551 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 927 [?]
Skill Endorsements: 203 [?]
Administrator
Featured
Sponsor
 
0
 

You need to put a new line before and after the code block. Unlike vBulletin's bbcode, Markdown is a more universal language used across many sites sich as Reddit, Github, etc. If you do a Google search for markdown tutorial or markdown documentation, you should be able to get a bunch of help.

Question Answered as of 2 Years Ago by Dani and deceptikon
Member Avatar
rubberman
Senior Poster
3,986 posts since Mar 2010
Reputation Points: 513 [?]
Q&As Helped to Solve: 500 [?]
Skill Endorsements: 87 [?]
 
0
 

Well, JMHO in that the new "standard" is fine, but you should still support the old bbcode blocks.

Member Avatar
Rashakil Fol
Super Senior Demiposter
2,596 posts since Jun 2005
Reputation Points: 982 [?]
Q&As Helped to Solve: 209 [?]
Skill Endorsements: 42 [?]
Team Colleague
 
0
 
Test
Member Avatar
Rashakil Fol
Super Senior Demiposter
2,596 posts since Jun 2005
Reputation Points: 982 [?]
Q&As Helped to Solve: 209 [?]
Skill Endorsements: 42 [?]
Team Colleague
 
0
 

Um.

The preview doesn't support ~~~.
Member Avatar
Dani
The Queen of DaniWeb
20,551 posts since Feb 2002
Reputation Points: 1,356 [?]
Q&As Helped to Solve: 927 [?]
Skill Endorsements: 203 [?]
Administrator
Featured
Sponsor
 
0
 

No, it currently doesn't.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article