![]() You can read the manual (in Chinese/English) for more details and examples. The starred version of all environments and macros are provided at the same time, such as codebox*, codeview*, \codefile* and \cvfile* which adds comment at bottom of the fancy box. An all round improvement to my way of thinking.Create code box and viewer based on tcolorbox and minted/listingsĬodebox is a L aT eX3 package developed based on tcolorbox and minted/listings, which provides environments codebox and codeview to typset with environment body, and macros \codefile and \cvfile to typeset programming source code from a file in a fancy box. It also had the benefit of reducing the assets required which in turn improved page load speed. When I retro-fied the code blocks it looked a little too clean and decided to drop it in favour of, yes, you guessed, default monospace for a more “traditional code” look. Which I mixed with Source Sans Pro for body copy and Lato for headings. I started this project using what I personally considered as the best font for displaying code – Source Code Pro. We have a basic container, and our content is encoded, we can add basic styling. Now the code block is selectable via CTRL A and the Home and End keys also work. ![]() The article Best Practice for Code Examples strongly suggests making code blocks editable for content navigation and selection, greatly improving accessibility and usability: Language HTML Very useful to indicate skipped pieces of irrelevant detail in code examples. It's written as three horizontal dots (…) and coded …. Consider it as the correct way of writing Yada, yada, yada. You may of noticed I've allowed one HTML symbol to remain, the ellipsis.Īn ellipsis is used to indicate an incomplete or partial fragment. See Syntactic sugaring later in this article for details. There are alternative HTML markup escaping methods available as extensions to the Prism highlighter, a little hacky though. If you need to know more see the PHP htmlspecialchars function. Please ensure the closing EOD appears as the first characters on its own line. $str = str_replace("…", "…", $str) Įverything sitting between 'EOD' and EOD will be automatically converted by PHP on the server. ![]() $str = htmlspecialchars($str, ENT_HTML5, ENT_NOQUOTES) This process used to be a royal pain in the proverbial but on applying a little PHP, we return the cream to the medicine cupboard. Escaping HTML, with PHPĪlternatively, by using a small snippet of PHP, we no longer have to manually encode symbols (,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |