-2

Possible Duplicate:
Bold code in a question
Allow highlighting certain bits of a code fragment or quote

Is there a way to apply rich formatting to some parts of your code? Sometimes, I have to paste a really large body of code (in case of an SQL query, for eg) but the relevant part (according to me) is very less. I could chop that out, but maybe the other part of the code contains something related to current issue? So - can you highlight a like of code or a few words among a big body of code?

marked as duplicate by Time Traveling Bobby, Mat, Arjan, Cody Gray, Flexo Apr 11 '12 at 18:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    The only way to do this now would be by using <pre><code> HTML tags, and then embedding tags like <strong> inside of that block. – Cody Gray Apr 11 '12 at 15:01
  • 6
    @TheEstablishment: Can we agree on not doing that? Editing posts which are utilizing HTML instead of Markdown is a little bit annoying. – Time Traveling Bobby Apr 11 '12 at 15:05
  • 1
    How about shortening the code, splitting it up or repeating the important few lines instead? – Time Traveling Bobby Apr 11 '12 at 15:07
  • @Bobby: Oh, I'm very much against it. But it's the only solution to this "problem". – Cody Gray Apr 11 '12 at 15:56
6

Sometimes, I have to paste a really large body of code

No, you don't.

If you are thinking of pasting so much code into a Stack Overflow question that you feel the need for formatting tools it is time for you to do a little work before you ask people to work for you: prepare a minimal working example that exhibits the problematic behavior.

If you solve the problem by doing so, good!

If you learn something in the process, good!

  • That's true. But I am working on a Ruby on Rails project, where creating a minimal working example would mean creating a whole new project with models and controllers and what not. But anyway, point noted. – Saad Rehman Shah Apr 12 '12 at 4:23
  • @SaadRehmanShah Well, I work on AngularJS projects which also have models and controllers and what not. But it's always possible to post only that part which will make the most difference. The key is posting only that. – cst1992 Apr 19 '16 at 8:02

Not the answer you're looking for? Browse other questions tagged .