-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?

4
  • 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
    Commented Apr 11, 2012 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. Commented Apr 11, 2012 at 15:05
  • 1
    How about shortening the code, splitting it up or repeating the important few lines instead? Commented Apr 11, 2012 at 15:07
  • @Bobby: Oh, I'm very much against it. But it's the only solution to this "problem".
    – Cody Gray
    Commented Apr 11, 2012 at 15:56

1 Answer 1

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!

2
  • 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. Commented Apr 12, 2012 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
    Commented Apr 19, 2016 at 8:02

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