Need help? Check out our Support site, then


How can I mark text inside tag CODE? For example as bold or as colored code.

  1. Hello,

    could you please advice,

    1. How can I mark text inside tag CODE?
    For example as bold or as colored code.

    Thanks

    The blog I need help with is testbilling.wordpress.com.

  2. panaghiotisadam
    Member

    To mark some text as bold, you highlight it and click the b button.

    To make part of the text inside a code tag pair red, you use a span tag pair with the style attribute (in the HTML editor, of course):
    <code>UNCOLORED PART <span style="color: #f00;">COLORED PART</span> UNCOLORED PART</code>
    To make all of it red, you use the style attribute in the opening code tag:
    <code style="color: #f00;">COLORED</code>

    The f00 I used is pure red. For colors and hex numbers see here:
    http://www.december.com/html/spec/color.html

    But perhaps the sourcecode shortcode will be more useful to you:
    http://en.support.wordpress.com/code/posting-source-code/

  3. Panaghiotisadam, Thank you.
    Very very helpful.

    Is there an option to highlite part of line insode tags [code] (not ) or [sourcecode]?

  4. sorry, again

    Is there an option to highlite part of line insode tags [ code ] (not < code >) or [ sourcecode ]?

  5. panaghiotisadam
    Member

    No. But I don't see why you want [ code ] instead of the other two options. What exactly do you wish to display?

  6. >> why you want [ code ] instead of the other two options.
    Because as I am understanding,
    there is no one powerful solution, but several different.

    < code > does not have options toolbar, language, etc.
    [ sourcecode ] does not have an option to highlite part of line

  7. panaghiotisadam
    Member

    In the other thread you started, you're asking about sql. So you should use this:

    [sourcecode language="sql"]
    YOUR CODE HERE
    [/sourcecode]

    Did you try it?

  8. I wrote about tage < CODE > and option language.
    And again, the question about highlited (colored or bold) part of line.

    As I understand only tag < CODE > allows this, right?

  9. panaghiotisadam
    Member

    Yes, if you mean coloring other than the one automatically produced when you use the sourcecode shortcode.

    Are you planning to publish much of this or a little? If a little, you might be able to use no code tags, just HTML entities for the various symbols (which you can style any way you like).

  10. Sorry I did not catch (my english is not so excellent).

    I am going to post big pieces of code with
    1) highlited LINES
    as here
    http://www.sql.ru/forum/actualutils.aspx?action=gotomsg&tid=704925&msg=7808468

    2) highlited PART OF LINES
    as here (look at "11.1.0.6.0")
    http://www.sql.ru/forum/actualutils.aspx?action=gotomsg&tid=704925&msg=7808468
    or here
    http://www.sql.ru/forum/actualutils.aspx?action=gotomsg&tid=704925&msg=7810038

    Am I right understanding that
    a) tag [ CODE ] does not allow highlite anything?
    and
    b ) tag [ SOURCECODE ] allows only to highlite whole LINES (with only gray color ?)

    And to highlite part of line only tag < CODE > is only the solution?

  11. panaghiotisadam
    Member

    a) Yes, the [ CODE ] and [ SOURCECODE ] tags don't allow function HTML and inline CSS inside them. The < code > tags do.

    b) The code I suggested in my first reply is for coloring the text itself. To highlight part of the text (if you use the third option), you use this:
    <span style="background-color: #f00;">HIGHLIGHTED PART</span>

    c) If you use the sourcecode shortcode, you can highlight any line you want this way:

    [sourcecode language="sql" highlight="LINE NUMBERS HERE, SEPARATED BY COMMAS"]
    YOUR CODE HERE
    [/sourcecode]

    But you cannot highlight part of a line.

  12. Unfortunately I have found that tag code does not do monospaced text.

    Example,

    tag [ CODE ]
    [code]
    | Hello world |
    | |
    |_____________|
    |-------------|
    [/code]

    tag < CODE >
    <br /> | Hello world |<br /> | |<br /> |___________|<br /> |-------------|<br />

    So, there is no an option to use monospaced text with colored marks?

  13. oh, tag [ CODE ] does not work here...
    Inside tag [ CODE ] my example has right borders, right line is not broken

  14. @testbilling
    The free hosted WordPress.com blog linked to your username is deviod of any blogger created content. Please post an active link starting with http:// to the blog you want this code for.

  15. So, as we can see tag < code > is not monospaced.

    Thus, the option only to use tags [ code ] and [ sourcecode ] where we
    1. cannot mark/highlight part of line
    2. can mark only whole line by only one color always
    3. This color is only gray

    Am I right?

  16. or absolutely specific question -
    I have following table
    [code]
    --------------------------------------------------------------------------------------------
    | Id | Operation | Name | C1 | C2 | C3 | C4 |
    --------------------------------------------------------------------------------------------
    | 0 | SUPER MEGA DJ | | 1 | 11 |00:00:00.01 | 128 |
    | 1 | VIEW | | 1 | 22 |00:00:00.01 | 123 |
    | 2 | HELLO WORLD | | 1 | 33 |00:00:00.01 | 242 |
    | 3 | SOME STRING3 | BILL | 1 | 44 |00:00:00.01 | 354 |
    | 4 | SOME STRING2 | BILLING2 | 1 | 55 |00:00:00.01 | 457 |
    --------------------------------------------------------------------------------------------
    [/code]

    Which options do I have to mark/highlight values
    1) value 44 in column C2
    2) value 242 in column C4

  17. Can anybody answer my questions?

    1) Is tag <CODE not monospaced, right?
    http://testbilling.wordpress.com/2012/02/01/23/

    2) Is there possibility to mark rows with, for example, with GREEN color ?

    3) Which options do I have to mark/highlight part of row?
    http://testbilling.wordpress.com/2012/02/01/q2/

  18. panaghiotisadam
    Member

    I have already answered your questions.

    • If you use the sourcecode shortcode, you can highlight any line by adding the line number in the shortcode (the way I showed in a previous reply), but you cannot highlight part of a line. And you don't control the color.

    • [ sourcecode ] and [ code ] don't accept functioning HTML and inline CSS inside them but < code > does. So you can do whatever you like if you use < code > with the right HTML tags and the right style attributes and values. To turn the content of that tag into monospace you'd write:

    <code style="font-family: Courier New, monospace;">
    CODE HERE
    </code>
  19. panaghiotisadam,
    I waited for this:
    >> To turn the content of that tag into monospace you'd write:
    GREAT! thanks

  20. panaghiotisadam
    Member

    You're welcome!

Topic Closed

This topic has been closed to new replies.

About this Topic