Button and/or keyboard shortcut for <code></code> formatting

  • Unknown's avatar

    Writing on programming topics means that one is frequently referring to language keywords and such, which should have formatting (usually resulting in the use of a monospace font). Unfortunately, it appears that there is no quick/easy way to apply this formatting in the visual editor; I'm finding that the easiest route is to apply all the formatting after writing the entry in full, by going to the HTML view and laboriously selecting each keyword, etc., and clicking the code button.

    Is there any way to get a ‘code’ button on the visual editor, or ideally, establish a key binding for that inline formatting in the visual editor? I suppose I could dig in and write a greasemonkey script for this, but that’s definitely a band-aid/punt compared to having a proper keybinding, etc. across all browsers.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Damn, didn’t notice that _code_ was going to be used in the formatting of the question. Sorry. :-/

  • Unknown's avatar

    Is this any help to you?
    Posting source code

    While WordPress.com doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. We have created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages http://en.support.wordpress.com/code/posting-source-code/

  • Unknown's avatar

    DANG! My bad. I just clicked yourusername and discovered it’s not linked to a wordpress.COM blog. On this forum we provide support only to those who have free blogs from and being free hosted by wordpress.COM

    Please verify by reading the sticky post at the head of this forum
    https://en.forums.wordpress.com/topic/please-read-me-first-before-posting?replies=1
    because if your want support for the blog linked to your username you are posting to the wrong forum and ought to be posting to http://wordpress.ORG/support/

  • Unknown's avatar

    I am referring to a wordpress.com blog, which I recently created; my profile was out of date, which I’ve corrected.

    I’m already posting blocks source code using the [sourcecode] formatting macro. I’m inquiring about a reasonable way to apply inline < code > formatting from within the visual editor.

  • Unknown's avatar

    The format style dropdown at the beginning of the second line of icons lets you insert the pre tag in the visual editor. You can also jump to the HTML editor using a keyboard shortcut, click on the help icon to view all shortcuts.

  • Unknown's avatar

    I guess the answer is, no, this doesn’t exist as a feature currently.

    pre is a block element, not an inline style.

  • Unknown's avatar
  • The topic ‘Button and/or keyboard shortcut for <code></code> formatting’ is closed to new replies.