Inline code syntax highlighting in GitHub markdown?

前端 未结 2 1268
时光取名叫无心
时光取名叫无心 2020-12-14 14:19

GitHub-flavored markdown supports syntax highlighting in codeblocks. This is done by adding the name of the language next to the triple-grave codeblock markers:



        
2条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 14:46

    Yes, it is possible with Github Markdown:

    I needed to do the same with an XML-structure inside a table row (in my case defined with markdown, nit html, so with | | delimitiers for the table structure)

    just put the desired Style-class (in my case .language-xml) within the Structure {: }

    ``{:.language-xml}
    

    this will set the style of the table cell to highlight the code according to the set style class

    i guess for ruby it then will just be

    {:.language-ruby}
    

    took me over an hour to figure out, found the solution nowhere, so i thought i'd post it here if anyone stumbles upon this problem again.

提交回复
热议问题