Skip to content

Commit 018fc23

Browse files
authored
fix: layout jump and more (#1077)
- fix hugo modules mounts for retrieval market - fix scrollbars and add fixed height to code blocks closes #1065 - fix dashboard resize anchor links wouldnt scroll to the proper section because dashboard creation would make the layout jump in size at runtime - remove logs
1 parent 5c23985 commit 018fc23

File tree

30 files changed

+1549
-74
lines changed

30 files changed

+1549
-74
lines changed

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,32 @@ You can find examples in the `config.toml`
4242
[[module.imports]]
4343
path = "github.com/filecoin-project/specs-actors"
4444
[[module.imports.mounts]]
45-
source = "actors"
46-
target = "content/modules/actors"
45+
source = "."
46+
target = "content/externals/specs-actors"
4747
```
48+
> `target` should **ALWAYS** use the folder `content/externals`
49+
4850
This makes files from external repos available for Hugo rendering and allows for linking to up-to-date files that are directly pulled from other repositories.
4951

5052
The configuration above gives the following information:
5153

52-
- `path`: gives the repository you want to mount content from.
53-
- `source`: the folder from the repository referenced in the `path` that we want to mount into our local Hugo filesystem. This is the "root" seen from your Hugo site where you pull content from. In the above case, this means that the source that will be mounted is `https://github.com/filecoin-project/specs-actors/actors/`.
54-
- `target`: the folder in your local Hugo site where the mounted content appears. In our case folder `content` is where we include all Hugo content.
54+
- `path`: Repository's URL without protocol.
55+
- `source`: Folder from the repository referenced in the `path` to be mounted into the local Hugo filesystem.
56+
- `target`: Folder where `source` will be mounted locally, this should follow this structure `content/modules/<target value>`.
5557

56-
Putting everything together in an example: if you want to link to the file `xyz.go` from `https://github.com/filecoin-project/specs-actors/actors/xyz-folder/xyz.go`, from any file within the local folder `content` (or any of its subfolders), then with the above configuration you have to include:
58+
Example: if you want to link/embed to the file `xyz.go` that lives in `https://github.com/filecoin-project/specs-actors/actors/xyz-folder/xyz.go`, from within a markdown file then with the above configuration the `src` for shortcodes or markdown image syntax would be:
5759

5860
```
59-
{{<embed src="/modules/actors/xyz-folder/xyz.go" lang="go">}}
61+
{{<embed src="/externals/specs-actors/actors/xyz-folder/xyz.go" lang="go">}}
6062
```
63+
> The first foward slash is important it means the path is relative to the content folder.
6164
6265
These modules can be updated with
6366

6467
```sh
6568
hugo mod get -u
6669
```
67-
or use specific version with
70+
or to a specific version with
6871

6972
```sh
7073
hugo mod get github.com/filecoin-project/specs-actors@v0.7.2
@@ -119,7 +122,7 @@ stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
119122
```
120123

121124
## Page Header
122-
The first heading should be # Head with `---` like below and should refer to the overall title of the document. The right nav **only** starts on the second level of headings.
125+
The first heading should be # Head with `---` like below and should refer to the overall title of the document.
123126

124127
```md
125128
---
@@ -146,18 +149,20 @@ Description for all the available frontmatter properties
146149
title: Libraries
147150
<!-- Small description for html metadata, if not present the first couple of paragraphs will be used instead -->
148151
description: Libraries used from Filecoin
149-
<!-- This will be used to order the navigation and any other listing of pages -->
152+
<!-- This will be used to order the ToC, navigation and any other listings of pages -->
150153
weight: 3
151154
<!-- This will make a page section collapse in the navigation -->
152155
bookCollapseSection: true
153156
<!-- This will hidden the page from the navigation -->
154157
bookhidden: true
155158
<!-- This is used in the dashboard to describe the importance of the page content -->
156159
dashboardWeight: 2
157-
<!-- This is used in the dashboard to describe the state of the page content options are "incorrect", "wip", "incomplete" and "stable" -->
160+
<!-- This is used in the dashboard to describe the state of the page content options are "missing", "incorrect", "wip", "reliable", "stable" or "n/a" -->
158161
dashboardState: stable
159-
<!-- This is used in the dashboard to describe if the theory of the page has been audited, options are 1 or 0 -->
160-
dashboardAudit: 1
162+
<!-- This is used in the dashboard to describe if the theory of the page has been audited, options are "missing", "wip", "stable" or "n/a" -->
163+
dashboardAudit: wip
164+
<!-- When dashboardAudit is stable we should have a report url -->
165+
dashboardAuditURL: https://url.to.the.report
161166
<!-- This is used in the dashboard to describe if the page content has compliance tests, options are 0 or numbers of tests -->
162167
dashboardTests: 0
163168
```

assets/_code.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.markdown pre {
2+
max-height: 450px;
3+
overflow: auto;
4+
}

assets/_custom.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
@import "plugins/toc";
1212
@import "katex";
1313
@import "icons";
14+
@import "code";
1415

1516
.markdown {
1617
overflow-x: hidden;
@@ -153,18 +154,16 @@ blockquote {
153154
}
154155
.book-menu nav {
155156
width: 20rem;
156-
padding: 1rem 0.2rem 4rem 1rem;
157+
height: 100%;
158+
padding: 1rem 0.2rem 1rem 1rem;
157159
position: fixed;
158160
top: 0;
159161
bottom: 0;
160-
overflow-x: initial;
161-
overflow-y: hidden;
162+
overflow: hidden;
162163
}
163-
164-
.book-menu nav .toc {
165-
overflow-x: hidden;
166-
overflow-y: auto;
164+
.book-menu .toc {
167165
height: 100%;
166+
overflow: hidden;
168167
}
169168

170169
.markdown>h1:first-of-type {

assets/_dashboard.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
#dashboard-container {
2+
height: 90vh;
3+
overflow: auto
4+
}
15
table.Dashboard {
26
display: table;
37
table-layout: fixed;
48
width: 100%;
59
font-size: 12px;
10+
margin: 0;
611
}
712

813
table.Dashboard {
@@ -21,7 +26,6 @@ table.Dashboard {
2126
}
2227

2328
.Dashboard-section {
24-
// max-width:250px;
2529
white-space: nowrap;
2630
overflow: hidden;
2731
text-overflow: ellipsis;

assets/js/content-model.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function buildTocModel (contentSelector) {
1414
let parents = [{tagName: 'H0', children: model}]
1515
let prevSibling = null
1616
for (let el of headingList) {
17-
console.log("buildTocModel -> el.dataset", el.dataset)
1817
let node = {
1918
id: el.id,
2019
tagName: el.tagName,

assets/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function initTocScrollSpy () {
6060
window.addEventListener('DOMContentLoaded', () => {
6161
const model = buildTocModel('.markdown')
6262
initToc({tocSelector:'.toc', model })
63-
buildDashboard('#test-dash', model)
63+
buildDashboard('#dashboard-container', model)
6464
initTocDepthSlider()
6565
initTocScrollSpy()
6666
initPanZoom()

assets/plugins/_scrollbars.scss

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,55 @@
11
@import "defaults";
22
@import "variables";
33

4-
// Webkit
54
::-webkit-scrollbar {
6-
width: 10px;
7-
height: 10px;
5+
width: 8.5px;
6+
height: 8.5px;
87
}
8+
9+
* {
10+
-ms-overflow-style: -ms-autohiding-scrollbar;
11+
scrollbar-width: thin;
12+
scrollbar-color: transparent rgba(0, 0, 0, 0.3) ;
13+
}
14+
915
::-webkit-scrollbar-thumb {
10-
background: rgba(255, 255, 255, 0.1);
16+
background: rgba(0, 0, 0, 0.3);
1117
border-radius: 6px;
1218
}
1319

14-
// MS
15-
body {
16-
-ms-overflow-style: -ms-autohiding-scrollbar;
17-
scrollbar-width: thin;
18-
scrollbar-color: rgba(255, 255, 255, 0.1) #232323;
20+
::-webkit-scrollbar-button,
21+
::-webkit-scrollbar-track-piece,
22+
::-webkit-scrollbar-corner,
23+
::-webkit-resizer { display: none; }
24+
25+
// code blocks
26+
.markdown pre::-webkit-scrollbar {
27+
display: none;
28+
}
29+
.markdown pre:hover::-webkit-scrollbar {
30+
display: initial;
1931
}
2032

33+
.markdown pre {
34+
scrollbar-color: transparent rgba(255, 255, 255, 0.1) ;
35+
}
36+
37+
.markdown pre::-webkit-scrollbar-thumb {
38+
background-color: rgba(255, 255, 255, 0.1);
39+
}
40+
.markdown pre::-webkit-scrollbar-thumb:active {
41+
background-color: rgba(255, 255, 255, 0.3);
42+
}
43+
44+
// toc
45+
.toc > ol::-webkit-scrollbar {
46+
display: none;
47+
}
48+
.toc > ol:hover::-webkit-scrollbar {
49+
display: initial;
50+
}
51+
52+
2153
// Future
2254
.book-menu nav {
2355
scrollbar-color: transparent $gray-500;

assets/plugins/_toc.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.toc {
22
overflow-y: auto;
33
> ol {
4-
overflow: hidden;
4+
height: 90%;
5+
overflow: auto;
56
position: relative;
67
> li {
78
font-weight: 500;

config.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# baseURL = '/'
22
title = 'Filecoin Spec'
3+
ignoreFiles= ["externals"]
34
# theme = 'book'
45
canonifyurls = false
56
relativeURLs = true
@@ -104,21 +105,15 @@ enableGitInfo = true
104105
[[module.imports]]
105106
path = "github.com/filecoin-project/specs-actors"
106107
[[module.imports.mounts]]
107-
source = "actors"
108-
target = "content/modules/actors"
108+
source = "."
109+
target = "content/externals/specs-actors"
109110
[[module.imports]]
110111
path = "github.com/filecoin-project/go-fil-markets"
111112
[[module.imports.mounts]]
112113
source = "."
113-
target = "content/modules/go-fil-markets"
114+
target = "content/externals/go-fil-markets"
114115
[[module.imports]]
115116
path = "github.com/filecoin-project/lotus"
116117
[[module.imports.mounts]]
117118
source = "."
118-
target = "content/modules/lotus"
119-
[[module.imports]]
120-
path = "github.com/filecoin-project/go-data-transfer"
121-
[[module.imports.mounts]]
122-
source = "."
123-
target = "content/modules/go-data-transfer"
124-
119+
target = "content/externals/lotus"

content/algorithms/crypto/randomness.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ GetRandomness(dst, l, s):
6868
return H(buffer)
6969
```
7070

71-
{{<embed src="/modules/actors/crypto/randomness.go" lang="go">}}
71+
{{<embed src="/externals/specs-actors/actors/crypto/randomness.go" lang="go">}}
7272
{{<embed src="/systems/filecoin_blockchain/struct/chain/chain.go" lang="go">}}
7373

7474
## Drawing tickets from the VRF-chain for proof inclusion

0 commit comments

Comments
 (0)