If you want to publish source codes as part of your content, you should consider highlighting the source codes in the content, not just for beautification, it helps the reader to see something familiar. In this post I am going to present a way of highlighting source codes in content which is applicable in all platforms. This easy way to highlight source codes in contents would only requires JS and CSS support.
So if you are a blogger who writes on computer programming and publish source codes in your blog post or if you just want to publish some source codes in your website, then what you can do to stand-out the code from other text is
- Use <code /> tags
- Use <pre /> tags
Cool. It will look like codes but not look like as it looks like in your favorite code editor, with different colors for constants, variables, functions, strings etc. along with line numbers.
So, what you want to do is to highlight source codes and make them appearing like in a code editor, which is just not for colors, but for more readability too.
If you want to publish source codes as part of your content, you should consider highlighting the source codes in the content, not just for beautification, it helps the reader to see something familiar. In this post I am going to present a way of highlighting source codes in content which is applicable in all platforms. This easy way to highlight source codes in contents would only requires JS and CSS support.
So if you are a blogger who writes on computer programming and publish source codes in your blog post or if you just want to publish some source codes in your website, then what you can do to stand-out the code from other text is
- Use <code /> tags
- Use <pre /> tags
Cool. It will look like codes but not look like as it looks like in your favorite code editor, with different colors for constants, variables, functions, strings etc. along with line numbers.
So, what you want to do is to highlight source codes and make them appearing like in a code editor, which is just not for colors, but for more readability too.