Skip to content

Commit 23eaffe

Browse files
committed
fix &
1 parent f8185ff commit 23eaffe

File tree

5 files changed

+10
-43
lines changed

5 files changed

+10
-43
lines changed

docs/manual/record.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,4 +660,5 @@ Optional record fields, introduced in [`v10`](/blog/release-10-0-0#experimental-
660660
After reading the constraints in the previous sections, and if you're coming from a dynamic language background, you might be wondering why one would bother with record in the first place instead of straight using object, since the former needs explicit typing and doesn't allow different records with the same field name to be passed to the same function, etc.
661661

662662
1. The truth is that most of the times in your app, your data's shape is actually fixed, and if it's not, it can potentially be better represented as a combination of variant (introduced next) + record instead.
663+
663664
2. Since a record type is resolved through finding that single explicit type declaration (we call this "nominal typing"), the type error messages end up better than the counterpart ("structural typing", like for tuples). This makes refactoring easier; changing a record type's fields naturally allows the compiler to know that it's still the same record, just misused in some places. Otherwise, under structural typing, it might get hard to tell whether the definition site or the usage site is wrong.

src/common/Url.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ let normalizeAnchor = string => {
112112
->String.replaceRegExp(/([\r\n]+ +)+/g, "")
113113
->String.replaceAll(" ", "-")
114114
->String.replaceAll("_", "-")
115+
->String.replaceAll("&", "")
115116
->String.replaceAllRegExp(/[^a-zA-Z0-9-]/g, "")
116117
->String.toLocaleLowerCase
117118
}

src/components/Markdown.res

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
// This file was automatically converted to ReScript from 'Markdown.re'
22
// Check the output and make sure to delete the original file
3-
4-
// type el = {@as("type") _type?: string}
5-
6-
// external elementObject: React.element => el = "%identity"
7-
8-
let childrenToString = element => {
9-
JSON.stringifyAny(ReactDOMServer.renderToStaticMarkup(element))
10-
->Option.getOr("")
11-
->String.replaceRegExp(/<[^>]+>/g, "")
12-
->String.replaceRegExp(/([\r\n]+ +)+/g, "")
13-
}
3+
external childrenToString: React.element => string = "%identity"
144

155
module P = {
166
@react.component

src/layouts/DocsLayout.res

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,7 @@ let make = (
8585

8686
let preludeSection =
8787
<div className="flex flex-col justify-between text-fire font-medium items-baseline">
88-
{switch version {
89-
| Some(version) =>
90-
switch availableVersions {
91-
| Some(availableVersions) =>
92-
let onChange = evt => {
93-
open Url
94-
ReactEvent.Form.preventDefault(evt)
95-
let version = (evt->ReactEvent.Form.target)["value"]
96-
let url = Url.parse((route :> string))
97-
WebAPI.Storage.setItem(
98-
localStorage,
99-
~key=switch metaTitleCategory {
100-
| "React" => (React :> string)
101-
| _ => (Manual :> string)
102-
},
103-
~value=version,
104-
)
105-
106-
let targetUrl =
107-
"/" ++
108-
(Array.join(url.base, "/") ++
109-
("/" ++ (version ++ ("/" ++ Array.join(url.pagepath, "/")))))
110-
navigate(targetUrl)
111-
}
112-
<VersionSelect version={"v12"} availableVersions=["v12", "pre v12"] />
113-
| None => <span className="font-mono text-14"> {React.string(version)} </span>
114-
}
115-
| None => React.null
116-
}}
88+
<VersionSelect version={"v12"} availableVersions=["v12", "pre v12"] />
11789
</div>
11890

11991
let sidebar =

styles/_markdown.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44

55
ol {
66
li {
7-
counter-increment: li;
7+
list-style-type: decimal;
88

99
&::before {
10-
content: counter(li) ".";
11-
@apply absolute font-semibold;
10+
@apply font-bold;
1211
}
12+
1313
}
14+
15+
1416
}
1517

18+
1619
ul {
1720
@apply mb-0;
1821

0 commit comments

Comments
 (0)