Skip to content

Commit 685f906

Browse files
Disable code block highlighting when no language is specified
1 parent 052c2cf commit 685f906

File tree

8 files changed

+25
-23
lines changed

8 files changed

+25
-23
lines changed

doc-tool/src/dotty/tools/dottydoc/staticsite/Site.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import java.nio.file.Path
1010
import java.nio.charset.StandardCharsets
1111
import java.io.File.{ separator => sep }
1212

13-
import com.vladsch.flexmark.parser.ParserEmulationProfile
14-
import com.vladsch.flexmark.parser.Parser
13+
import com.vladsch.flexmark.parser.{ Parser, ParserEmulationProfile }
1514
import com.vladsch.flexmark.ext.gfm.tables.TablesExtension
1615
import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension
1716
import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension
1817
import com.vladsch.flexmark.ext.emoji.EmojiExtension
1918
import com.vladsch.flexmark.ext.autolink.AutolinkExtension
2019
import com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension
2120
import com.vladsch.flexmark.ext.yaml.front.matter.YamlFrontMatterExtension
21+
import com.vladsch.flexmark.html.HtmlRenderer
2222
import com.vladsch.flexmark.util.options.{ DataHolder, MutableDataSet }
2323

2424
import dotc.core.Contexts.Context
@@ -447,6 +447,8 @@ object Site {
447447
new MutableDataSet()
448448
.setFrom(ParserEmulationProfile.KRAMDOWN.getOptions)
449449
.set(Parser.INDENTED_CODE_BLOCK_PARSER, false)
450+
.set(HtmlRenderer.FENCED_CODE_LANGUAGE_CLASS_PREFIX, "")
451+
.set(HtmlRenderer.FENCED_CODE_NO_LANGUAGE_CLASS, "nohighlight")
450452
.set(AnchorLinkExtension.ANCHORLINKS_WRAP_TEXT, false)
451453
.set(AnchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, "anchor")
452454
.set(EmojiExtension.ROOT_IMAGE_PATH, "https://github.global.ssl.fastly.net/images/icons/emoji/")

doc-tool/test/dotty/tools/dottydoc/MarkdownTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class MarkdownTests extends DottyDocTest with CheckFromSource {
211211
.trim
212212

213213
assertEquals(
214-
"""|<pre><code class="language-scala">val x = 1 + 5
214+
"""|<pre><code class="scala">val x = 1 + 5
215215
|</code></pre>""".stripMargin, traitCmt)
216216
}
217217
}
@@ -242,7 +242,7 @@ class MarkdownTests extends DottyDocTest with CheckFromSource {
242242
.trim
243243

244244
assertEquals(
245-
"""|<pre><code class="language-scala">val x = 1 + 5
245+
"""|<pre><code class="scala">val x = 1 + 5
246246
|</code></pre>""".stripMargin, traitCmt)
247247
}
248248
}

docs/docs/internals/backend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: "Backend Internals"
66
The code for the backend is split up by functionality and assembled in the
77
object `GenBCode`.
88

9-
```none
9+
```
1010
object GenBCode --- [defines] --> PlainClassBuilder GenBCode also defines class BCodePhase, the compiler phase
1111
| |
1212
[extends] [extends]

docs/docs/internals/overall-structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: "Dotty Overall Structure"
66
The compiler code is found in package [dotty.tools]. It spans the
77
following three sub-packages:
88

9-
```none
9+
```
1010
backend Compiler backends (currently for JVM and JS)
1111
dotc The main compiler
1212
io Helper modules for file access and classpath handling.
@@ -23,7 +23,7 @@ Package Structure
2323
Most functionality of `dotc` is implemented in subpackages of `dotc`. Here's a
2424
list of sub-packages and their focus.
2525

26-
```none
26+
```
2727
.
2828
├── ast // Abstract syntax trees
2929
├── config // Compiler configuration, settings, platform specific definitions.

docs/docs/internals/type-system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ the `underlying` method, other types are called _ground_ types and inherit
1515

1616
Here's a diagram, copied from [dotty/tools/dotc/core/Types.scala][1]:
1717

18-
```none
18+
```
1919
Type -+- ProxyType --+- NamedType ----+--- TypeRef
2020
| | \
2121
| +- SingletonType-+-+- TermRef

docs/docs/reference/metaprogramming/macros-spec.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: "Macros Spec"
99

1010
Compared to the [Dotty reference grammar](../../internals/syntax.md)
1111
there are the following syntax changes:
12-
```none
12+
```
1313
SimpleExpr ::= ...
1414
| ‘'’ ‘{’ Block ‘}’
1515
| ‘'’ ‘[’ Type ‘]’
@@ -56,7 +56,7 @@ extends simply-typed lambda calculus with quotes and splices.
5656
### Syntax
5757

5858
The syntax of terms, values, and types is given as follows:
59-
```none
59+
```
6060
Terms t ::= x variable
6161
(x: T) => t lambda
6262
t t application
@@ -76,7 +76,7 @@ Typing rules are formulated using a stack of environments
7676
`Es`. Individual environments `E` consist as usual of variable
7777
bindings `x: T`. Environments can be combined using the two
7878
combinators `'` and `$`.
79-
```none
79+
```
8080
Environment E ::= () empty
8181
E, x: T
8282
@@ -93,7 +93,7 @@ right identity `()`.
9393
### Operational semantics:
9494

9595
We define a small step reduction relation `-->` with the following rules:
96-
```none
96+
```
9797
((x: T) => t) v --> [x := v]t
9898
9999
${'u} --> u
@@ -107,7 +107,7 @@ rule says that splice and quotes cancel each other out. The third rule
107107
is a context rule; it says that reduction is allowed in the hole `[ ]`
108108
position of an evaluation context. Evaluation contexts `e` and
109109
splice evaluation context `e_s` are defined syntactically as follows:
110-
```none
110+
```
111111
Eval context e ::= [ ] | e t | v e | 'e_s[${e}]
112112
Splice context e_s ::= [ ] | (x: T) => e_s | e_s t | u e_s
113113
```
@@ -116,7 +116,7 @@ Splice context e_s ::= [ ] | (x: T) => e_s | e_s t | u e_s
116116
Typing judgments are of the form `Es |- t: T`. There are two
117117
substructural rules which express the fact that quotes and splices
118118
cancel each other out:
119-
```none
119+
```
120120
Es1 * Es2 |- t: T
121121
---------------------------
122122
Es1 $ E1 ' E2 * Es2 |- t: T
@@ -129,7 +129,7 @@ cancel each other out:
129129
The lambda calculus fragment of the rules is standard, except that we
130130
use a stack of environments. The rules only interact with the topmost
131131
environment of the stack.
132-
```none
132+
```
133133
x: T in E
134134
--------------
135135
Es * E |- x: T
@@ -146,7 +146,7 @@ environment of the stack.
146146
```
147147
The rules for quotes and splices map between `expr T` and `T` by trading `'` and `$` between
148148
environments and terms.
149-
```none
149+
```
150150
Es $ () |- t: expr T
151151
--------------------
152152
Es |- $t: T

docs/docs/usage/dottydoc.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ and will from here on be referred to as "template files" or "templates".
2424

2525
A simple "hello world" site could look something like this:
2626

27-
```none
27+
```
2828
├── docs
2929
│ └── getting-started.md
3030
└── index.html
3131
```
3232

3333
This will give you a site with the following endpoints:
3434

35-
```none
35+
```
3636
_site/index.html
3737
_site/docs/getting-started.html
3838
```
@@ -79,7 +79,7 @@ the `index.html` file.
7979

8080
Layouts must be placed in a `_layouts` directory in the site root:
8181

82-
```none
82+
```
8383
├── _layouts
8484
│ └── main.html
8585
├── docs
@@ -97,7 +97,7 @@ the form `year-month-day-title.{md,html}`.
9797

9898
An example of this would be:
9999

100-
```none
100+
```
101101
├── blog
102102
│ └── _posts
103103
│ └── 2016-12-05-implicit-function-types.md
@@ -130,7 +130,7 @@ includes may override these.
130130

131131
An example structure with an include file "sidebar.html":
132132

133-
```none
133+
```
134134
├── _includes
135135
│ └── sidebar.html
136136
├── blog
@@ -167,7 +167,7 @@ depth limit is 2 - we'd love to see this change, contributions welcome!
167167
The items which have the `subsection` key, may not have a `url` key in the
168168
current scheme. A site root example with this could be:
169169

170-
```none
170+
```
171171
├── blog
172172
│ └── _posts
173173
│ └── 2016-12-05-implicit-function-types.md

docs/docs/usage/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Releases are available for download on the [Releases Section](https://github.com
4040
of the Dotty repository. Releases include three executables: `dotc` the Dotty compiler,
4141
`dotd` the [Dotty Documentation tool](./dottydoc.md) and `dotr` the Dotty REPL.
4242

43-
```none
43+
```
4444
.
4545
└── bin
4646
   ├── dotc

0 commit comments

Comments
 (0)