Skip to content

Commit ebfd571

Browse files
authored
feat: Various updates
Close #199 #200 #201 #202 #203 #204 #205 #115 #211
1 parent 36aa58e commit ebfd571

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2991
-2788
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/build/
22
/node_modules/
33
/public/
4+
.vscode

.stylelintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"comment-empty-line-before": null,
55
"no-descending-specificity": null,
66
"rule-empty-line-before": null,
7+
"value-keyword-case": ["lower", { "ignoreKeywords": ["BlinkMacSystemFont", "Roboto", "Helvetica", "Arial"] }]
78
}
89
}

gulp.d/tasks/generate-octicons.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
'use strict'
2+
3+
const octicons = require('@primer/octicons')
4+
const ospath = require('path')
5+
const fs = require('fs')
6+
7+
const icons = [
8+
'alert',
9+
'book',
10+
'chevron-down',
11+
'chevron-left',
12+
'copy',
13+
'flame',
14+
'fold',
15+
'home',
16+
'info',
17+
'law',
18+
'light-bulb',
19+
'moon',
20+
'question',
21+
'rocket',
22+
'search',
23+
'stop',
24+
'sun',
25+
'three-bars',
26+
'unfold',
27+
'x',
28+
]
29+
30+
const pathRegex = /<svg .+?>(.*)<\/svg>/m
31+
32+
const preamble = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 208">
33+
<title>Octicons</title>
34+
<desc>Octicons by GitHub - https://primer.style/octicons/ - License: MIT</desc>
35+
<metadata
36+
xmlns:dc="http://purl.org/dc/elements/1.1/"
37+
xmlns:cc="http://creativecommons.org/ns#"
38+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
39+
<rdf:RDF>
40+
<cc:Work rdf:about="">
41+
<dc:title>@primer/octicons</dc:title>
42+
<dc:description>A scalable set of icons handcrafted with &lt;3 by GitHub</dc:description>
43+
<dc:format>image/svg+xml</dc:format>
44+
<dc:creator>
45+
<cc:Agent>
46+
<dc:title>GitHub</dc:title>
47+
</cc:Agent>
48+
</dc:creator>
49+
<dc:rights>
50+
<cc:Agent>
51+
<dc:title>Copyright (c) GitHub Inc.</dc:title>
52+
</cc:Agent>
53+
</dc:rights>
54+
<cc:license rdf:resource="https://opensource.org/licenses/MIT" />
55+
<dc:relation>https://primer.style/octicons/</dc:relation>
56+
</cc:Work>
57+
</rdf:RDF>
58+
</metadata>
59+
60+
`
61+
62+
function generateOcticons (cb) {
63+
let result = preamble
64+
let offset = 0
65+
for (const icon of icons) {
66+
const svg = octicons[icon].toSVG({ width: 16, height: 16 })
67+
const path = pathRegex.exec(svg)[1]
68+
result += ` <symbol id="icon-${icon}" viewBox="0 0 16 16">
69+
${path}
70+
</symbol>
71+
<use href="#icon-${icon}" width="16" height="16" x="0" y="${offset}" />
72+
<view id="view-${icon}" viewBox="0 ${offset} 16 16" />
73+
74+
`
75+
offset += 16
76+
}
77+
result += '</svg>'
78+
const filename = ospath.join(__filename, '../../../src/img/octicons-16.svg')
79+
fs.writeFile(filename, result, cb)
80+
cb()
81+
}
82+
83+
module.exports = () => generateOcticons

gulpfile.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const lintTask = createTask({
5555
const formatJsTask = createTask({
5656
name: 'format:js',
5757
desc: 'Format the JavaScript source files using prettify (JavaScript Standard Style)',
58-
call: task.format(glob.test),
58+
call: task.format(glob.js),
5959
})
6060

6161
const formatTestJsTask = createTask({
@@ -130,6 +130,12 @@ const previewTask = createTask({
130130
call: series(previewBuildTask, previewServeTask),
131131
})
132132

133+
const generateOcticons = createTask({
134+
name: 'generateOcticons',
135+
desc: 'Generates an SVG file with the octicons we use',
136+
call: task.generateOcticons(),
137+
})
138+
133139
module.exports = exportTasks(
134140
bundleTask,
135141
cleanTask,
@@ -140,5 +146,6 @@ module.exports = exportTasks(
140146
bundlePackTask,
141147
previewTask,
142148
previewBuildTask,
143-
packTask
149+
packTask,
150+
generateOcticons
144151
)

package-lock.json

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

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"devDependencies": {
2121
"@asciidoctor/core": "~2.2",
22-
"@asciidoctor/tabs": "1.0.0-beta.3",
22+
"@asciidoctor/tabs": "1.0.0-beta.6",
2323
"@docsearch/js": "3",
2424
"@springio/asciidoctor-extensions": "1.0.0-alpha.8",
2525
"algoliasearch": "4",
@@ -29,9 +29,9 @@
2929
"chai": "~4.3",
3030
"chai-fs": "~2.0",
3131
"chai-spies": "~1.0",
32-
"dirty-chai": "~2.0",
3332
"core-js": "~3.26",
3433
"cssnano": "~5.1",
34+
"dirty-chai": "~2.0",
3535
"eslint": "~6.8",
3636
"eslint-config-standard": "~14.1",
3737
"eslint-plugin-import": "~2.22",
@@ -52,9 +52,9 @@
5252
"highlight.js": "9.18.3",
5353
"instantsearch.js": "^4.54.1",
5454
"js-yaml": "~4.1",
55-
"mocha": "~10.2",
5655
"merge-stream": "~2.0",
5756
"micromodal": "^0.4.10",
57+
"mocha": "~10.2",
5858
"postcss": "~8.4",
5959
"postcss-calc": "~8.2",
6060
"postcss-custom-properties": "~12.1",
@@ -68,6 +68,7 @@
6868
"vinyl-fs": "~3.0"
6969
},
7070
"dependencies": {
71-
"@algolia/client-search": "^4.17.0"
71+
"@algolia/client-search": "^4.17.0",
72+
"@primer/octicons": "^19.8.0"
7273
}
7374
}

preview-src/index.adoc

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ Don't forget this step!
406406
.Key Points to Remember
407407
[TIP]
408408
====
409-
If you installed the CLI and the default site generator globally, you can upgrade both of them with the same command.
409+
If you installed the CLI and the default `site-generator` globally, you can upgrade both of them with the same command.
410410
411411
$ npm i -g @antora/cli @antora/site-generator-default
412412
====
@@ -463,6 +463,135 @@ Showing a gear icon: icon:gear[]
463463

464464
====== H6
465465

466+
467+
== Edge cases
468+
469+
There are a few things that can trip our stylesheet up if we're not careful:
470+
471+
472+
=== Title with Code (`withcode`)
473+
474+
Restdocs uses these and they should look nice.
475+
476+
=== Long Tables
477+
478+
A table with long entries and no breakable space.
479+
480+
[cols="1,2", options="header"]
481+
.Issues
482+
|===
483+
|Name
484+
|Description
485+
486+
|VeryLongNameWithoutBreakableSpaceVeryLongNameWithoutBreakableSpaceVeryLongNameWithoutBreakableSpaceVeryLongNameWithoutBreakableSpace
487+
|This is an edge case
488+
489+
|Name
490+
|Another entry
491+
|===
492+
493+
That's the end of that.
494+
495+
496+
497+
=== Another Long Table
498+
499+
When a Spring Boot application starts:
500+
501+
[cols="2,2,2,3,5"]
502+
|===
503+
|Startup phase |LivenessState |ReadinessState |HTTP server |Notes
504+
505+
|Starting
506+
|`BROKEN`
507+
|`REFUSING_TRAFFIC`
508+
|Not started
509+
|Kubernetes checks the "liveness" Probe and restarts the application if it takes too long.
510+
511+
|Started
512+
|`CORRECT`
513+
|`REFUSING_TRAFFIC`
514+
|Refuses requests
515+
|The application context is refreshed. The application performs startup tasks and does not receive traffic yet.
516+
517+
|Ready
518+
|`CORRECT`
519+
|`ACCEPTING_TRAFFIC`
520+
|Accepts requests
521+
|Startup tasks are finished. The application is receiving traffic.
522+
|===
523+
524+
When a Spring Boot application shuts down:
525+
526+
[cols="2,2,2,3,5"]
527+
|===
528+
|Shutdown phase |Liveness State |Readiness State |HTTP server |Notes
529+
530+
|Running
531+
|`CORRECT`
532+
|`ACCEPTING_TRAFFIC`
533+
|Accepts requests
534+
|Shutdown has been requested.
535+
536+
|Graceful shutdown
537+
|`CORRECT`
538+
|`REFUSING_TRAFFIC`
539+
|New requests are rejected
540+
|If enabled, <<spring-boot-features#boot-features-graceful-shutdown,graceful shutdown processes in-flight requests>>.
541+
542+
|Shutdown complete
543+
|N/A
544+
|N/A
545+
|Server is shut down
546+
|The application context is closed and the application is shut down.
547+
|===
548+
549+
TIP: Check out the Kubernetes container lifecycle section for more information about Kubernetes deployment.
550+
551+
552+
553+
=== Long Shell Blocks
554+
555+
A shell code block can also break things:
556+
557+
[indent=0,subs="attributes"]
558+
----
559+
. ____ _ __ _ _
560+
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
561+
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
562+
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
563+
' |____| .__|_| |_|_| |_\__, | / / / /
564+
=========|_|==============|___/=/_/_/_/
565+
:: Spring Boot :: v{spring-boot-version}
566+
567+
2019-04-31 13:09:54.117 INFO 56603 --- [ main] o.s.b.s.app.SampleApplication : Starting SampleApplication v0.1.0 on mycomputer with PID 56603 (/apps/myapp.jar started by pwebb)
568+
2019-04-31 13:09:54.166 INFO 56603 --- [ main] ationConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6e5a8246: startup date [Wed Jul 31 00:08:16 PDT 2013]; root of context hierarchy
569+
2019-04-01 13:09:56.912 INFO 41370 --- [ main] .t.TomcatServletWebServerFactory : Server initialized with port: 8080
570+
2019-04-01 13:09:57.501 INFO 41370 --- [ main] o.s.b.s.app.SampleApplication : Started SampleApplication in 2.992 seconds (JVM running for 3.658)
571+
----
572+
573+
574+
=== Code With `nowrap`
575+
576+
Have some HTTP that also has `nowrap` set:
577+
578+
[source,http,options="nowrap"]
579+
----
580+
HTTP/1.1 200 OK
581+
Content-Type: application/vnd.spring-boot.actuator.v3+json
582+
Content-Length: 121
583+
{
584+
"events" : [ {
585+
"timestamp" : "2021-03-18T16:49:30.625Z",
586+
"principal" : "alice",
587+
"type" : "logout"
588+
} ]
589+
}
590+
----
591+
592+
593+
594+
466595
== Fin
467596

468597
That's all, folks!

0 commit comments

Comments
 (0)