Skip to content

Add syntax highlighting capabilities #1450

@tunetheweb

Description

@tunetheweb

Authors sometimes include small code snippets to illustrate example usage. It would be nice to syntax highlight that for readability.

We do support a limited form and use it in the methodology page but it basically needs to be lovingly written by hand at the moment:

<div class="code-block floating-card">
<pre><code><span class="code-comment">#standardSQL
# 01_01b: Distribution of JS bytes by client</span>
<span class="code-keyword">SELECT</span>
percentile,
_TABLE_SUFFIX <span class="code-keyword">AS</span> client,
<span class="code-function">APPROX_QUANTILES</span>(<span class="code-function">ROUND</span>(bytesJs <span class="code-keyword">/</span> <span class="code-number">1024</span>, <span class="code-number">2</span>), <span class="code-number">1000</span>)[<span class="code-function">OFFSET</span>(percentile <span class="code-keyword">*</span> <span class="code-number">10</span>)] <span class="code-keyword">AS</span> js_kbytes
<span class="code-keyword">FROM</span>
<span class="code-string">`httparchive.summary_pages.2019_07_01_*`</span>,
<span class="code-function">UNNEST</span>([<span class="code-number">10</span>, <span class="code-number">25</span>, <span class="code-number">50</span>, <span class="code-number">75</span>, <span class="code-number">90</span>]) <span class="code-keyword">AS</span> percentile
<span class="code-keyword">GROUP BY</span>
percentile,
client
<span class="code-keyword">ORDER BY</span>
percentile,
client</code></pre>
</div>

That may be sufficient for now but a nicer code formatter would be better so something to look at at some point.

@HTTPArchive/developers anyone any suggestions of a (lightweight!) third-party one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    developmentBuilding the Almanac tech stack

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions