CppCoreGuidelines icon indicating copy to clipboard operation
CppCoreGuidelines copied to clipboard

should ```cpp be used to quote code samples?

Open ChrisGuzak opened this issue 4 years ago • 6 comments

I see we are getting generic code formatting via 4 space indents

void foo() {}

An alternative, that give syntax-highlights, is to use "3 ticks"cpp code "3 ticks"

void foo() {}

should we update all of the samples to use this?

ChrisGuzak avatar Jul 14 '20 21:07 ChrisGuzak

The last one is better and more readable.

markyin avatar Jul 15 '20 02:07 markyin

gave it a shot colorizing P.1 in gh-pages it colorizes when viewed on github https://github.com/isocpp/CppCoreGuidelines/blob/gh-pages/CppCoreGuidelines.md#Rp-direct but not on gh-pages, generated HTML confusingly says <div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code class="no-highlight"> http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rp-direct

I wonder if we're missing something in _config.yml

cubbimew avatar Aug 03 '20 21:08 cubbimew

there we go, http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rp-direct now shows how it looks with CSS produced by rougify style github Still, the colors on github's own viewer look much better (they appear to come from https://github.com/primer/github-syntax-theme-generator )

cubbimew avatar Aug 03 '20 21:08 cubbimew

I started on, but did not make much progress on a PowerShell script to find and quote all samples. If others are aware of similar scripts that we could borrow from please share.

ChrisGuzak avatar Aug 05 '20 16:08 ChrisGuzak

@ChrisGuzak maybe that you could implement a custom transform following a regex ? using https://github.com/DavidWells/markdown-magic

note: color highlighting really is important to democratize the guidelines

LifeIsStrange avatar Feb 21 '21 06:02 LifeIsStrange

To be fair, as-is http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines.html has that "Turn ON Syntax" button that colors it up. But backticks-cpp may still be a good idea

cubbimew avatar Mar 11 '21 20:03 cubbimew