Note: I posted this on stack overflow but couldn't get an answer. I am trying it here.

I have files that are in urdf [Unified Robot Description Format] for ROS and sdf [Simulation Description Format] for gazebo. URDF is xml but Github only shows it in black. How can I get Github to show syntax highlighting on the file? Can I do this for any file extension including a missing extension?

NOTE: I am not referring to comments in markdown so back ticks don't apply.

<sdf version='1.6'>
  <world name='default'>


      <pose frame=''>0 0 30 0 0 0</pose>



Stack Overflow's syntax highlighting seems to get it.

  • $\begingroup$ I would suggest that you reach out to GitHub support and request that they add detection and syntax highlighting of the file format. $\endgroup$
    – Tully
    Sep 3, 2021 at 8:44
  • $\begingroup$ On stack exchange, comments are not intended for extended discussions, they are for helping to improve questions and answers. Comments are distracting, so we try to keep them to a minimum. They should be considered ephemeral, any comment which no longer actively helps to improve a question or answer may be deleted at any time to tidy up a post. For extended discussion on a question or answer, please use Robotics Chat when you have chat privileges. $\endgroup$
    – Mark Booth
    Sep 7, 2021 at 13:19

1 Answer 1


The GitHub page on code blocks has a section on syntax highlighting that says:

Syntax highlighting

You can add an optional language identifier to enable syntax highlighting in your fenced code block.

For example, to syntax highlight Ruby code:

require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

github highlighting

More information is provided below that example:

We use Linguist to perform language detection and to select third-party grammars for syntax highlighting. You can find out which keywords are valid in the languages YAML file.

In reviewing the third-party grammars it looks like URDF specifically isn't included, but XML is. Since the URDF "is an XML format for representing a robot model," I'd just tag the block as XML.


Just re-read and you say you're asking about files, not comments, but I checked a URDF file here and it looks like the following for me:

URDF markup

If there's some other issue you've got please link a specific example where it's not working for you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.