Skip to content

Commit 7c8382a

Browse files
committed
Support language-specific highlighting using highlight.js
- Also make minor documentation fixes and improvements.
1 parent 13c7d3d commit 7c8382a

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

markdown/index.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
<meta charset="utf-8" />
66
<title>Documentation | Eclipse Project</title>
77
<link rel="preconnect stylesheet" href="../project.css" />
8+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
89
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
910
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
1011
<script src="https://cdn.jsdelivr.net/npm/marked-gfm-heading-id/lib/index.umd.js"></script>
12+
<script src="https://cdn.jsdelivr.net/npm/marked-highlight/lib/index.umd.js"></script>
13+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
14+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/java.min.js"></script>
15+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/xml.min.js"></script>
16+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/properties.min.js"></script>
1117
<script src="../project.js"></script>
1218
<style>
1319
/* <![CDATA[*/
@@ -155,6 +161,31 @@
155161
border: none;
156162
}
157163

164+
.language-java .hljs-number {
165+
color: mediumblue;
166+
}
167+
168+
.language-java .hljs-string {
169+
color: darkcyan;
170+
}
171+
172+
.language-java .hljs-title {
173+
color: indigo;
174+
}
175+
176+
.language-xml .hljs-string {
177+
color: darkslategray;
178+
}
179+
180+
.language-xml .hljs-attr {
181+
color: purple;
182+
}
183+
184+
.language-xml .hljs-name {
185+
font-weight: 100;
186+
color: darkblue;
187+
}
188+
158189
/*]]>*/
159190
</style>
160191
</head>
@@ -374,6 +405,14 @@ <h2>Table of Contents</h2>
374405
const text = response;
375406
const editLink = `<a id="edit-markdown-link" href=""><span class="orange">\u270E Improve this page</span></a>\n`;
376407
marked.use(markedGfmHeadingId.gfmHeadingId());
408+
marked.use(markedHighlight.markedHighlight({
409+
emptyLangClass: 'hljs',
410+
langPrefix: 'hljs language-',
411+
highlight(code, lang, info) {
412+
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
413+
return hljs.highlight(code, {language}).value;
414+
}
415+
}));
377416
marked.use({
378417
hooks: {
379418
postprocess(html) {

news/4.38/platform_isv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ A special thanks to everyone who [contributed to Eclipse-Platform](acknowledgeme
2222

2323
A new `drawImage` method in `GC` allows drawing the **full image** into a specified destination rectangle:
2424
```java
25-
GC#drawImage(image, destX, destY, destWidth, destHeight)
25+
GC.drawImage(image, destX, destY, destWidth, destHeight)
2626
```
2727
Until now, the existing method `drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight)` was used for this purpose by specifying the full source bounds.
2828
The new method simplifies the process by eliminating the need to provide the actual image bounds when drawing the entire image.

news/4.39/platform_isv.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ gc.dispose();
6565
pdf.dispose();
6666
```
6767

68-
This enhancement eliminates the need for external PDF libraries and provides a native, platform-integrated solution for PDF generation in SWT applications. See Snippet388 for a complete working example.
68+
This enhancement eliminates the need for external PDF libraries and provides a native, platform-integrated solution for PDF generation in SWT applications.
69+
See [Snippet388](https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet388.java) for a complete working example.

0 commit comments

Comments
 (0)