开发者

How do I format code neatly in HTML/CSS ? I especially want to use the numerical circle callouts, with Python Docutils if I can

开发者 https://www.devze.com 2023-03-27 03:33 出处:网络
see: http://diveintopython.net/native_data_types/lists.html#d0e5623 I have a website with code examples on it, generated through docutils, and the CSS is always not quite right.

see: http://diveintopython.net/native_data_types/lists.html#d0e5623

I have a website with code examples on it, generated through docutils, and the CSS is always not quite right.

I would like to know if there is

  • best practise CSS for displaying code (ie can it handle wrap arounds, long lines, any chance of getting colourisation)

  • best practise for the little numerical callouts (开发者_开发百科see diveintopython above)

and finally, I am wondering if there is (open) CSS that is designed to work with docutils HTML output and actually look "nice". I would be happy to contribute some CSS that makes tables look "microsoft professional grey" and so forth.


You can't do syntax highlighting with CSS alone. You need the various parts of the code to be marked up; you can do that on the server if you are using dynamic pages, or you can use JavaScript on the client. Here is a comparison of a few JavaScript syntax highlighters.

The circled numbers are images in the site you linked, but I would use Unicode instead: ❶➋➌➍➎➏➐➑➒➓

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号