Skip to content

Commit 36de722

Browse files
authored
Enable Syntax highlight to all languages in the documentation
Enable Syntax highlight to all languages in the documentation
2 parents 377af0a + eb4bc7e commit 36de722

File tree

5 files changed

+48
-5
lines changed

5 files changed

+48
-5
lines changed

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"node-fetch": "^3.2.6",
4646
"nouislider": "^13.1.1",
4747
"npm": "^8.13.2",
48+
"prismjs": "^1.28.0",
4849
"prop-types": "^15.7.2",
4950
"react": "^16.13.1",
5051
"react-datetime": "^2.16.3",

src/@rocketseat/gatsby-theme-docs/styles/global.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ import React from 'react';
22
import { Global, css } from '@emotion/react';
33
import { useTheme } from '@emotion/react';
44

5+
// Add syntax highlight for languages not enabled by default
6+
// https://github.com/FormidableLabs/prism-react-renderer#faq
7+
import Prism from "prism-react-renderer/prism";
8+
9+
(typeof global !== "undefined" ? global : window).Prism = Prism;
10+
11+
require("prismjs/components/prism-kotlin");
12+
require("prismjs/components/prism-java");
13+
require("prismjs/components/prism-ruby");
14+
require("prismjs/components/prism-csharp")
15+
16+
517
export default function GlobalStyle() {
618
const theme = useTheme();
719

@@ -273,6 +285,22 @@ export default function GlobalStyle() {
273285
content: 'bash';
274286
}
275287
288+
pre[class~='language-java']::before {
289+
content: 'Java';
290+
}
291+
292+
pre[class~='language-csharp']::before {
293+
content: 'C#';
294+
}
295+
296+
pre[class~='language-ruby']::before {
297+
content: 'Ruby';
298+
}
299+
300+
pre[class~='language-kotlin']::before {
301+
content: 'Kotlin';
302+
}
303+
276304
pre[class~='language-yaml']::before,
277305
pre[class~='language-yml']::before {
278306
content: 'yaml';

src/docs/getting-started/java-sdk/trace-auto-instr.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ version of this artifact can not be newer than the version of the agent. Notably
8888
artifact, any usage of it will be disabled by the agent.
8989

9090
##### For Gradle:
91-
```java lineNumbers=true
91+
```kotlin lineNumbers=true
9292
dependencies {
9393
implementation("io.opentelemetry:opentelemetry-api:1.6.0")
9494
}

src/docs/getting-started/java-sdk/trace-manual-instr.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Several components provide the functionality for using OpenTelemetry SDK with X-
3535
to align dependency versions for non-contrib components.
3636

3737
##### For Gradle:
38-
```java lineNumbers=true
38+
```kotlin lineNumbers=true
3939
dependencies {
4040
api(platform("io.opentelemetry:opentelemetry-bom:1.6.0"))
4141

@@ -108,7 +108,7 @@ OpenTelemetrySdk.builder()
108108
ContextPropagators.create(
109109
TextMapPropagator.composite(
110110
W3CTraceContextPropagator.getInstance(), AwsXrayPropagator.getInstance())))
111-
111+
112112
// This provides basic configuration of a TracerProvider which generates X-Ray compliant IDs
113113
.setTracerProvider(
114114
SdkTracerProvider.builder()
@@ -125,7 +125,7 @@ AWS resource detectors for enriching traces with AWS infrastructure information
125125
artifact.
126126

127127
##### For Gradle:
128-
```java lineNumbers=true
128+
```kotlin lineNumbers=true
129129
dependencies {
130130
implementation("io.opentelemetry:opentelemetry-sdk-extension-aws")
131131
}
@@ -179,7 +179,7 @@ the `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha` B
179179
library instrumentation. When using this, do not include `opentelemetry-bom`.
180180

181181
##### For Gradle:
182-
```java lineNumbers=true
182+
```kotlin lineNumbers=true
183183
dependencies {
184184
api(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.6.0-alpha"))
185185

0 commit comments

Comments
 (0)