Color (syntax highlighting) within an HTML tag

后端 未结 3 1300
感情败类
感情败类 2021-01-30 17:13

In a code fragment like the following ...

class Foo
{
  internal Foo()
  {
    for (int i = 0; i < 42; ++i);
  }
}

... its various keywords

3条回答
  •  温柔的废话
    2021-01-30 18:00

    Stack Overflow uses Google's prettify JS library for doing syntax highlighting. It executes on the client side after the HTML has been delivered by the server. That's why you don't see it in the raw HTML source. If you have a browser plugin such as FireBug, you'll be able to inspect the DOM after prettify has done its magic.

    Update 2020-09-14: Stack Overflow switched from Google's prettify to highlight.js.

提交回复
热议问题