Skip to content

Commit

Permalink
enh(multi-class) use hybrid scope approach
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Apr 21, 2021
1 parent 7b6df3d commit 51806aa
Show file tree
Hide file tree
Showing 36 changed files with 102 additions and 86 deletions.
33 changes: 23 additions & 10 deletions docs/css-classes-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,35 @@ in mind so a better choice might be ``string`` or perhaps ``string.link``.
| deletion | deleted line |
+--------------------------+-------------------------------------------------------------+

A note on multi-scope classes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A note on classes with sub-scopes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some scope names above have a ``.`` in them. We use this notation to specify
multiple scopes. In the generated HTML this will output two separate classes.
For example, Lets say the scope name is ``title.class``. The generated HTML
would be:
sub-scopes. In the generated HTML this will output multiple computed class
names. The depth of nesting determines the number of underscores appended to
sub-scope names. For example, Lets say the scope is ``title.class.other``.

The CSS class names generated would be:

- ``hljs-title``
- ``class_``
- ``other__``

The top-level scope is always the one that has the configured prefix applied.

The generated HTML would be:

::

class <span class="hljs-title hljs-class">Render</span>
<span class="hljs-title class_ other__">Render</span>

A theme could then simply target that using the following CSS:

.. code-block:: css
Render is a ``title``, the title of a ``class`` in particular. Some definitions
still use nested rules/tags to do this, but the preferred way is now to handle
this with the new multi-scope classes and simplify the language definitions when
possible.
.hljs-title.class_.other__ {
color: blue;
}
A note on newer classes
Expand Down
5 changes: 4 additions & 1 deletion src/lib/html_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const emitsWrappingTags = (node) => {
const expandClassName = (name, { prefix }) => {
if (name.includes(".")) {
const pieces = name.split(".");
return pieces.map(x => `${prefix}${x}`).join(" ");
return [
`${prefix}${pieces.shift()}`,
...(pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`))
].join(" ");
}
return `${prefix}${name}`;
};
Expand Down
2 changes: 1 addition & 1 deletion src/styles/atom-one-dark-reasonable.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
color: #98c379;
}
.hljs-built_in,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #e6c07b;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/atom-one-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ hue-6-2: #e6c07b
}

.hljs-built_in,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #e6c07b;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/atom-one-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ hue-6-2: #c18401
}

.hljs-built_in,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #c18401;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/foundation.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Date: 2013-04-02


.hljs-class .hljs-title,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-type {
color: #458;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/github.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

.hljs-built_in,
.hljs-symbol,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
/* prettylights-syntax-variable */
color: #e36209;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/grayscale.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ grayscale style (c) MY Sun <simonmysun@gmail.com>
font-weight: normal;
}

.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type,
.hljs-name {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/hopscotch.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}

/* Yellow */
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #fdcc59;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/monokai-sublime.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
}

.hljs-params,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #f8f8f2;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/monokai.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Monokai style - ported by Luigi Maselli - http://grigio.org
color: #a6e22e;
}

.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: white;
}
Expand Down
4 changes: 2 additions & 2 deletions src/styles/nnfx-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@
color: #a85;
}

.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type {
color: #96c;
}

.hljs-function.hljs-title,
.hljs-title.function_,
.hljs-function .hljs-title,
.hljs-attr,
.hljs-subst {
Expand Down
4 changes: 2 additions & 2 deletions src/styles/nnfx-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@
color: #642;
}

.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type {
color: #639;
}

.hljs-function.hljs-title,
.hljs-title.function_,
.hljs-function .hljs-title,
.hljs-attr,
.hljs-subst {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/obsidian.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}

.hljs-code,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-section {
color: white;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/pojoaque.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Based on Solarized Style from http://ethanschoonover.com/solarized

.hljs-variable,
.hljs-template-variable,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type,
.hljs-tag {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/qtcreator-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Qt Creator dark color scheme

.hljs-variable,
.hljs-params,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #8888ff;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/qtcreator-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Qt Creator light color scheme

.hljs-variable,
.hljs-params,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #0055AF;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/rainbow.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Style with support for rainbow parens
.hljs-variable,
.hljs-template-variable,
.hljs-selector-id,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #ffcc66;
}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/solarized-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmai
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type {
color: #b58900;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/solarized-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmai
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type {
color: #b58900;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/sunburst.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Sunburst-like style (c) Vasily Polovnyov <vast@whiteants.net>
color: #89bdff;
}

.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-doctag {
text-decoration: underline;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/xcode.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ XCode style (c) Angel Garcia <angelgarcia.mail@gmail.com>
}


.hljs-title.hljs-class,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-type,
.hljs-built_in,
Expand Down
4 changes: 2 additions & 2 deletions test/api/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('.highlight()', () => {

result.value.should.equal(
'<span class="hljs-keyword">public</span> ' +
'<span class="hljs-keyword">void</span> <span class="hljs-title hljs-function">moveTo</span>' +
'<span class="hljs-keyword">void</span> <span class="hljs-title function_">moveTo</span>' +
'<span class="hljs-params">(<span class="hljs-type">int</span> x, ' +
'<span class="hljs-type">int</span> y, ' +
'<span class="hljs-type">int</span> z)</span>;'
Expand All @@ -48,7 +48,7 @@ describe('.highlight()', () => {

result.value.should.equal(
'<span class="hljs-keyword">public</span> ' +
'<span class="hljs-keyword">void</span> <span class="hljs-title hljs-function">moveTo</span>' +
'<span class="hljs-keyword">void</span> <span class="hljs-title function_">moveTo</span>' +
'<span class="hljs-params">(<span class="hljs-type">int</span> x, ' +
'<span class="hljs-type">int</span> y, ' +
'<span class="hljs-type">int</span> z)</span>;'
Expand Down
2 changes: 1 addition & 1 deletion test/markup/arcade/profile.expect.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<span class="hljs-comment">/*
Isolated test for the most recent version
*/</span>
<span class="hljs-keyword">function</span> <span class="hljs-title hljs-function">offsetPopulation</span>(<span class="hljs-params">offset</span>){
<span class="hljs-keyword">function</span> <span class="hljs-title function_">offsetPopulation</span>(<span class="hljs-params">offset</span>){
<span class="hljs-keyword">var</span> popDensity = <span class="hljs-built_in">Round</span>( <span class="hljs-symbol">$feature</span>.POPULATION / <span class="hljs-built_in">AreaGeodetic</span>(<span class="hljs-built_in">Geometry</span>(<span class="hljs-symbol">$feature</span>), <span class="hljs-string">&quot;square-kilometers&quot;</span>) );
<span class="hljs-keyword">var</span> geom = <span class="hljs-built_in">Geometry</span>({ <span class="hljs-string">&#x27;x&#x27;</span>: offset.x, <span class="hljs-string">&#x27;y&#x27;</span>: offset.y, <span class="hljs-string">&#x27;spatialReference&#x27;</span>:{<span class="hljs-string">&#x27;wkid&#x27;</span>:<span class="hljs-number">102100</span>} });
<span class="hljs-keyword">var</span> myLayer = <span class="hljs-built_in">FeatureSet</span>(<span class="hljs-symbol">$map</span>, [<span class="hljs-string">&quot;POPULATION&quot;</span>, <span class="hljs-string">&quot;ELECTION-DATA&quot;</span>]);
Expand Down
2 changes: 1 addition & 1 deletion test/markup/autoit/default.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
_Singleton(<span class="hljs-symbol">@ScriptName</span>) <span class="hljs-comment">; Allow only one instance</span>
example(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>)

<span class="hljs-keyword">Func</span> <span class="hljs-title hljs-function">example</span><span class="hljs-params">($min, $max)</span>
<span class="hljs-keyword">Func</span> <span class="hljs-title function_">example</span><span class="hljs-params">($min, $max)</span>
<span class="hljs-keyword">For</span> $i = $min <span class="hljs-keyword">To</span> $max
<span class="hljs-keyword">If</span> <span class="hljs-built_in">Mod</span>($i, <span class="hljs-number">2</span>) == <span class="hljs-number">0</span> <span class="hljs-keyword">Then</span>
<span class="hljs-built_in">MsgBox</span>(<span class="hljs-number">64</span>, <span class="hljs-string">&quot;Message&quot;</span>, $i &amp; <span class="hljs-string">&#x27; is even number!&#x27;</span>)
Expand Down
2 changes: 1 addition & 1 deletion test/markup/cpp/primitive-types.expect.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<span class="hljs-keyword">const</span> <span class="hljs-keyword">uint64_t</span> MAX_INT_64;

<span class="hljs-keyword">struct</span> <span class="hljs-title hljs-class">position_tag</span>;
<span class="hljs-keyword">struct</span> <span class="hljs-title class_">position_tag</span>;
14 changes: 7 additions & 7 deletions test/markup/cpp/template_complexity.expect.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<span class="hljs-keyword">template</span> &lt;<span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">T</span>&gt; <span class="hljs-comment">// comment</span>
<span class="hljs-keyword">template</span> &lt;<span class="hljs-keyword">class</span> <span class="hljs-title class_">T</span>&gt; <span class="hljs-comment">// comment</span>
<span class="hljs-function"><span class="hljs-keyword">auto</span> <span class="hljs-title">foo</span><span class="hljs-params">(T x)</span> </span>{ ... };

<span class="hljs-keyword">namespace</span> impl {
<span class="hljs-keyword">template</span>&lt;<span class="hljs-keyword">typename</span> T&gt;
<span class="hljs-keyword">struct</span> <span class="hljs-title hljs-class">is_streamable</span>&lt;T, std::<span class="hljs-keyword">void_t</span>&lt;<span class="hljs-keyword">decltype</span>(std::declval&lt;std::wostream &amp;&gt;() &lt;&lt; std::declval&lt;T&gt;())&gt;&gt; : std::true_type { };
<span class="hljs-keyword">struct</span> <span class="hljs-title class_">is_streamable</span>&lt;T, std::<span class="hljs-keyword">void_t</span>&lt;<span class="hljs-keyword">decltype</span>(std::declval&lt;std::wostream &amp;&gt;() &lt;&lt; std::declval&lt;T&gt;())&gt;&gt; : std::true_type { };
}

<span class="hljs-comment">// Disable overload for already valid operands.</span>
<span class="hljs-keyword">template</span>&lt;<span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">T</span>, class = std::<span class="hljs-keyword">enable_if_t</span>&lt;!impl::is_streamable_v&lt;<span class="hljs-keyword">const</span> T &amp;&gt; &amp;&amp; std::is_convertible_v&lt;<span class="hljs-keyword">const</span> T &amp;, std::wstring_view&gt;&gt;&gt;
<span class="hljs-keyword">template</span>&lt;<span class="hljs-keyword">class</span> <span class="hljs-title class_">T</span>, class = std::<span class="hljs-keyword">enable_if_t</span>&lt;!impl::is_streamable_v&lt;<span class="hljs-keyword">const</span> T &amp;&gt; &amp;&amp; std::is_convertible_v&lt;<span class="hljs-keyword">const</span> T &amp;, std::wstring_view&gt;&gt;&gt;
std::wostream &amp;<span class="hljs-keyword">operator</span> &lt;&lt;(std::wostream &amp;stream, <span class="hljs-keyword">const</span> T &amp;thing)
{
<span class="hljs-keyword">return</span> stream &lt;&lt; <span class="hljs-keyword">static_cast</span>&lt;std::wstring_view&gt;(thing);
}

<span class="hljs-keyword">enum struct</span> <span class="hljs-title hljs-class">DataHolder</span> { };
<span class="hljs-keyword">enum class</span> <span class="hljs-title hljs-class">DataThingy</span> { };
<span class="hljs-keyword">enum class</span> <span class="hljs-title hljs-class">Boolean</span> : <span class="hljs-keyword">char</span> {
<span class="hljs-keyword">enum struct</span> <span class="hljs-title class_">DataHolder</span> { };
<span class="hljs-keyword">enum class</span> <span class="hljs-title class_">DataThingy</span> { };
<span class="hljs-keyword">enum class</span> <span class="hljs-title class_">Boolean</span> : <span class="hljs-keyword">char</span> {
True, False, FileNotFound
};

<span class="hljs-keyword">union</span> <span class="hljs-title hljs-class">Soy</span>
<span class="hljs-keyword">union</span> <span class="hljs-title class_">Soy</span>
{
};
2 changes: 1 addition & 1 deletion test/markup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function testLanguage(language, {testDir}) {

// Uncomment this for major changes that rewrite the test expectations
// which will then need to be manually compared by hand of course
// require('fs').writeFileSync(filename, actual);
require('fs').writeFileSync(filename, actual);

actual.trim().should.equal(expected.trim());
done();
Expand Down
6 changes: 3 additions & 3 deletions test/markup/java/annotations.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<span class="hljs-meta">@Slf4j</span>
<span class="hljs-meta">@RunWith(SpringRunner.class)</span>
<span class="hljs-meta">@Something(1+(3+4))</span>
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">BoardControllerTest</span> {
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">BoardControllerTest</span> {
}

<span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">Example</span> {
<span class="hljs-keyword">void</span> <span class="hljs-title hljs-function">foo</span><span class="hljs-params">(<span class="hljs-meta">@SuppressWarnings(&quot;unused&quot;)</span> <span class="hljs-type">int</span> bar)</span> { }
<span class="hljs-keyword">class</span> <span class="hljs-title class_">Example</span> {
<span class="hljs-keyword">void</span> <span class="hljs-title function_">foo</span><span class="hljs-params">(<span class="hljs-meta">@SuppressWarnings(&quot;unused&quot;)</span> <span class="hljs-type">int</span> bar)</span> { }
}
4 changes: 2 additions & 2 deletions test/markup/java/functions.expect.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> &lt;A,B,C&gt; Tuple&lt;A,B,C&gt; <span class="hljs-title hljs-function">fun</span><span class="hljs-params">(Future&lt;Tuple&lt;A,B,C&gt;&gt; future)</span> <span class="hljs-keyword">throws</span> Exceptions {
<span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> &lt;A,B,C&gt; Tuple&lt;A,B,C&gt; <span class="hljs-title function_">fun</span><span class="hljs-params">(Future&lt;Tuple&lt;A,B,C&gt;&gt; future)</span> <span class="hljs-keyword">throws</span> Exceptions {
}

<span class="hljs-keyword">static</span> Optional&lt;List&lt;Token&gt;&gt; <span class="hljs-title hljs-function">parseAll</span><span class="hljs-params">(String s)</span> {
<span class="hljs-keyword">static</span> Optional&lt;List&lt;Token&gt;&gt; <span class="hljs-title function_">parseAll</span><span class="hljs-params">(String s)</span> {
}
4 changes: 2 additions & 2 deletions test/markup/java/gh1031.expect.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">DefaultDataDaoImpl</span> {
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">DefaultDataDaoImpl</span> {
<span class="hljs-keyword">private</span> List&lt;AbstractCmrDataProcessor&gt; cmrDataProcessors;
}

<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">DefaultDataDaoImpl</span> {
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">DefaultDataDaoImpl</span> {
<span class="hljs-keyword">private</span> List&lt;AbstractCmrDataProcessor, AbstractCmrDataProcessor&gt; cmrDataProcessors;
}
6 changes: 3 additions & 3 deletions test/markup/java/titles.expect.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title hljs-class">Greet</span> {
<span class="hljs-keyword">public</span> Either&lt;Integer, String&gt; <span class="hljs-title hljs-function">f</span><span class="hljs-params">(<span class="hljs-type">int</span> val)</span> {
<span class="hljs-keyword">new</span> <span class="hljs-title hljs-class">Type</span>();
<span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Greet</span> {
<span class="hljs-keyword">public</span> Either&lt;Integer, String&gt; <span class="hljs-title function_">f</span><span class="hljs-params">(<span class="hljs-type">int</span> val)</span> {
<span class="hljs-keyword">new</span> <span class="hljs-title class_">Type</span>();
<span class="hljs-keyword">if</span> (val) {
<span class="hljs-keyword">return</span> getType();
} <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (!val) {
Expand Down
6 changes: 3 additions & 3 deletions test/markup/rust/traits.expect.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<span class="hljs-keyword">fn</span> <span class="hljs-title hljs-function">sqr</span>(i: <span class="hljs-type">i32</span>) { i * i }
<span class="hljs-keyword">trait</span> <span class="hljs-title hljs-class">Minimum</span> : <span class="hljs-built_in">Copy</span> {}
<span class="hljs-keyword">pub</span> <span class="hljs-keyword">trait</span> <span class="hljs-title hljs-class">Builder</span> <span class="hljs-keyword">where</span> <span class="hljs-keyword">Self</span>: <span class="hljs-built_in">Sized</span> + <span class="hljs-built_in">Iterator</span>&lt;Item=Event&gt; {}
<span class="hljs-keyword">fn</span> <span class="hljs-title function_">sqr</span>(i: <span class="hljs-type">i32</span>) { i * i }
<span class="hljs-keyword">trait</span> <span class="hljs-title class_">Minimum</span> : <span class="hljs-built_in">Copy</span> {}
<span class="hljs-keyword">pub</span> <span class="hljs-keyword">trait</span> <span class="hljs-title class_">Builder</span> <span class="hljs-keyword">where</span> <span class="hljs-keyword">Self</span>: <span class="hljs-built_in">Sized</span> + <span class="hljs-built_in">Iterator</span>&lt;Item=Event&gt; {}
8 changes: 4 additions & 4 deletions test/markup/rust/types.expect.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span class="hljs-keyword">type</span> <span class="hljs-title hljs-class">A</span>: Trait;
<span class="hljs-keyword">type</span> <span class="hljs-title hljs-class">A</span>;
<span class="hljs-keyword">type</span> <span class="hljs-title hljs-class">A</span> = B;
<span class="hljs-keyword">type</span> <span class="hljs-title hljs-class">R</span>&lt;T&gt; = m::R&lt;T, ConcreteError&gt;
<span class="hljs-keyword">type</span> <span class="hljs-title class_">A</span>: Trait;
<span class="hljs-keyword">type</span> <span class="hljs-title class_">A</span>;
<span class="hljs-keyword">type</span> <span class="hljs-title class_">A</span> = B;
<span class="hljs-keyword">type</span> <span class="hljs-title class_">R</span>&lt;T&gt; = m::R&lt;T, ConcreteError&gt;

0 comments on commit 51806aa

Please sign in to comment.