Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
71c2897
refactor: switch to React Router
jderochervlk Sep 28, 2025
3d46e64
refactor: add order and section to language manual frontmatter
jderochervlk Sep 28, 2025
365d522
Merge branch 'vlk/add-order-and-section-to-manual' of github.com:resc…
jderochervlk Sep 28, 2025
24c9fdc
add react
jderochervlk Sep 28, 2025
bce0ea1
Merge branch 'vlk/add-order-and-section-to-manual' of github.com:resc…
jderochervlk Sep 28, 2025
b3e42b7
improve css loading speed
jderochervlk Sep 28, 2025
62a4916
fix fouc
jderochervlk Sep 28, 2025
2a54652
fix css not loading
jderochervlk Sep 28, 2025
100fb4c
make sure progress is synced
jderochervlk Oct 1, 2025
3b5acdb
language manual
jderochervlk Oct 2, 2025
1217a60
working on tables
jderochervlk Oct 2, 2025
4d28ff6
back out table changes for now
jderochervlk Oct 2, 2025
a39d058
updating blog pages
jderochervlk Oct 3, 2025
06987bb
builds are working
jderochervlk Oct 3, 2025
5282ad2
copy to out folder
jderochervlk Oct 3, 2025
50c193e
add static server
jderochervlk Oct 3, 2025
b0c3673
cleanup some deps
jderochervlk Oct 5, 2025
d167bf2
cleanup some todo comments
jderochervlk Oct 5, 2025
f571352
configure loadmdx
jderochervlk Oct 5, 2025
8c812c6
tables looking good
jderochervlk Oct 5, 2025
96d9032
more mdx work
jderochervlk Oct 5, 2025
4732229
Merge branch 'master' of github.com:rescript-lang/rescript-lang.org i…
jderochervlk Oct 5, 2025
565e2d2
move react docs
jderochervlk Oct 7, 2025
009596d
react docs and anchor scrolling
jderochervlk Oct 7, 2025
c23be9b
fixed scrolling on full page nav
jderochervlk Oct 7, 2025
5a5904f
api is rendering
jderochervlk Oct 7, 2025
778f521
api prerender is working
jderochervlk Oct 7, 2025
f566bec
working on api table of contents
jderochervlk Oct 8, 2025
f478604
Initial plan
Copilot Oct 12, 2025
34acb8f
Migrate CodeMirror from v5 to v6 - initial implementation
Copilot Oct 12, 2025
1040aa7
Fix warnings and remove CodeMirror v5 dependency
Copilot Oct 12, 2025
cc339b5
Address code review feedback - fix import paths, error handling, and …
Copilot Oct 12, 2025
8311c48
Fix error validation logic - properly validate both line and column b…
Copilot Oct 12, 2025
6a1b928
Clarify error position indexing in comments - rows are 1-based, colum…
Copilot Oct 12, 2025
87c0785
Fix ReferenceError: createEditor is not defined - call function direc…
Copilot Oct 13, 2025
a631fc4
Format JavaScript files with Prettier
Copilot Oct 13, 2025
5ee2f10
Convert createEditor from raw JavaScript to native ReScript with comp…
Copilot Oct 13, 2025
924e84a
apidocs
jderochervlk Oct 13, 2025
1213a43
use more idiomatic rescript bindings
tsnobip Oct 13, 2025
bc74250
api nav is working
jderochervlk Oct 13, 2025
a90d0a8
trying to fix the inline codeblock
jderochervlk Oct 13, 2025
f8185ff
just remove it for now
jderochervlk Oct 13, 2025
23eaffe
fix &
jderochervlk Oct 13, 2025
31058cb
move syntax pages
jderochervlk Oct 13, 2025
6942b6b
working on blog listing page
jderochervlk Oct 14, 2025
0321c41
working on syntax page
jderochervlk Oct 14, 2025
e997c36
blog listing page is mostly working
jderochervlk Oct 15, 2025
a599198
update to rc.2
jderochervlk Oct 17, 2025
eed9347
blog post is rendering
jderochervlk Oct 17, 2025
bd882a6
fix archived blog posts
jderochervlk Oct 19, 2025
58001ca
Merge branch 'master' of github.com:rescript-lang/rescript-lang.org i…
jderochervlk Oct 19, 2025
0a505e7
static builds are working
jderochervlk Oct 19, 2025
9fe79d8
rendering community pages
jderochervlk Oct 19, 2025
f8dc09b
getting close
jderochervlk Oct 20, 2025
91f9442
package search
jderochervlk Oct 20, 2025
b07a66c
syntax lookup
jderochervlk Oct 20, 2025
dc0ad5d
remove package-lock
jderochervlk Oct 20, 2025
654f09e
rebuild package lock
jderochervlk Oct 20, 2025
b7ba93f
fix webapi
jderochervlk Oct 20, 2025
9ce7121
fixes
jderochervlk Oct 20, 2025
14f7bd2
Merge branch 'master' of github.com:rescript-lang/rescript-lang.org i…
jderochervlk Oct 20, 2025
0fcf8a8
Merge branch 'copilot/migrate-playground-to-cm-v6' of github.com:resc…
jderochervlk Oct 20, 2025
9272d9d
control panel
jderochervlk Oct 20, 2025
7d7bbdf
fix divider
jderochervlk Oct 20, 2025
f676837
more cleanup
jderochervlk Oct 20, 2025
8f15c78
more style fixes
jderochervlk Oct 20, 2025
89112cc
config cleanup
jderochervlk Oct 20, 2025
b1156d8
delete pages folder
jderochervlk Oct 20, 2025
ec22753
Merge branch 'master' of github.com:rescript-lang/rescript-lang.org i…
jderochervlk Oct 21, 2025
0b63251
rebuild package lock and remove .nvmrc
jderochervlk Oct 21, 2025
a5bbc50
try fixing missing types
jderochervlk Oct 22, 2025
219742d
add search
jderochervlk Oct 22, 2025
c9f8095
use npm build
jderochervlk Oct 22, 2025
011e271
fix typo
jderochervlk Oct 22, 2025
7a22a0a
fix package lock webapi version
jderochervlk Oct 22, 2025
0b9887a
run formatter
jderochervlk Oct 22, 2025
ba425b2
rollback codemirror
jderochervlk Oct 23, 2025
201a0ea
back to codemirror 5
jderochervlk Oct 23, 2025
3d650b7
Revert "use more idiomatic rescript bindings"
jderochervlk Oct 23, 2025
ad9b581
back to codemirror 5
jderochervlk Oct 23, 2025
a0ce329
Revert "rollback codemirror"
jderochervlk Oct 23, 2025
7dbe3df
playground is working
jderochervlk Oct 23, 2025
45b99f2
fix background color on dropdown
jderochervlk Oct 23, 2025
3015186
warning table
jderochervlk Oct 23, 2025
d5b111b
docson
jderochervlk Oct 23, 2025
1882fa0
fixed markdown
jderochervlk Oct 23, 2025
3852202
import css
jderochervlk Oct 24, 2025
70aeb1c
remove trailing ;
jderochervlk Oct 24, 2025
ce8576d
add back tests
jderochervlk Oct 24, 2025
7dc4b86
fix doc tests
jderochervlk Oct 24, 2025
0304baa
remove href test
jderochervlk Oct 24, 2025
d48b592
test out redirects
jderochervlk Oct 24, 2025
8547f39
formatting
jderochervlk Oct 24, 2025
11a742f
add 404 page
jderochervlk Oct 24, 2025
91d8860
typo in redirects
jderochervlk Oct 24, 2025
3b0bd2d
fix filename
jderochervlk Oct 24, 2025
20a153b
fix prettier ignore
jderochervlk Oct 24, 2025
113e21b
preconnect to css
jderochervlk Oct 24, 2025
ff62b7b
fix flicker
jderochervlk Oct 24, 2025
9f886db
fix community link
jderochervlk Oct 24, 2025
2d42ed9
Fix community links
jderochervlk Oct 24, 2025
2b785e2
fix search box and docson
jderochervlk Oct 26, 2025
14d00a1
getting meta tags to work
jderochervlk Nov 4, 2025
666f235
meta tags
jderochervlk Nov 4, 2025
20227bb
Merge branch 'master' of github.com:rescript-lang/rescript-lang.org i…
jderochervlk Nov 4, 2025
7cf2561
fix image imports after merge
jderochervlk Nov 4, 2025
6880219
formatting
jderochervlk Nov 4, 2025
2074165
align naming for Lazy components
jderochervlk Nov 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix doc tests
  • Loading branch information
jderochervlk committed Oct 24, 2025
commit 7dc4b86e69cbb3144bea08175478e213ba7b9197
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ index_data/*.json
_tempFile.cmi
_tempFile.cmj
_tempFile.cmt

# these docs are checked in, but we consider them frozen.
# pages/docs/manual/v8.0.0/
# pages/docs/manual/v9.0.0/
_tempFile.res
temp

.bsb.lock
.merlin
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/async-await.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ let fetchData = async () => {
Console.log("user 2 mail: " ++ user2Mail)
}

| exception JsError(err) => Console.log2("Some error occurred", err)
| exception JsExn(err) => Console.log2("Some error occurred", err)
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/exception.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ You can directly match on exceptions _while_ getting another return value from a
<CodeTab labels={["ReScript", "JS Output"]}>

```res prelude
switch list{1, 2, 3}->List.getExn(4) {
switch list{1, 2, 3}->List.getOrThrow(4) {
| item => Console.log(item)
| exception Not_found => Console.log("No such item found!")
}
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ let somethingThatMightThrow = async () => throw(SomeReScriptException)
let someAsyncFn = async () => {
switch await somethingThatMightThrow() {
| data => Some(data)
| exception JsError(_) => None
| exception JsExn(_) => None
| exception SomeReScriptException => None
}
}
Expand Down
27 changes: 18 additions & 9 deletions docs/manual/generalized-algebraic-data-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type timezone =

Using this variant type, we will end up having functions like this:

```res example
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
```res
let convertToDaylight = tz => {
switch tz {
| EST => EDT
Expand All @@ -47,15 +48,17 @@ This function is only valid for a subset of our variant type's constructors but

Let's see if we can find a way for the compiler to help us with normal variants. We could define another variant type to distinguish the two kinds of timezone.

```res example
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
```res
type daylightOrStandard =
| Daylight(timezone)
| Standard(timezone)
```

This has a lot of problems. For one, it's cumbersome and redundant. We would now have to pattern-match twice whenever we deal with a timezone that's wrapped up here. The compiler will force us to check whether we are dealing with daylight or standard time, but notice that there's nothing stopping us from providing invalid timezones to these constructors:

```res example
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
```res
let invalidTz1 = Daylight(EST)
let invalidTz2 = Standard(EDT)
```
Expand All @@ -78,7 +81,8 @@ type rec timezone<_> =
We define our type with a type parameter. We manually annotate each constructor, providing it with the correct type parameter indicating whether it is standard or daylight. Each constructor is a `timezone`,
but we've added another level of specificity using a type parameter. Constructors are now understood to be `standard` or `daylight` at the _type_ level. Now we can fix our function like this:

```res example
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
```res
let convertToDaylight = tz => {
switch tz {
| EST => EDT
Expand All @@ -92,7 +96,8 @@ The compiler can infer correctly that this function should only take `timezone<s
we try to return a standard timezone from this function. Actually, this seems like it could be a problem,
we still want to be able to match on all cases of the variant sometimes, and a naive attempt at this will not pass the type checker. A naive example will fail:

```res example
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
```res
let convertToDaylight = tz =>
switch tz {
| EST => EDT
Expand All @@ -104,7 +109,8 @@ let convertToDaylight = tz =>

This will complain that `daylight` and `standard` are incompatible. To fix this, we need to explicitly annotate to tell the compiler to accept both:

```res example
{/* TODO: fix this example, it has an error because it doesn't have access to the previous snippet */}
```res
let convertToDaylight : type a. timezone<a> => timezone<daylight> = // ...
```

Expand All @@ -117,7 +123,8 @@ Sometimes, a function should have a different return type based on what you give

[^1]: In ReScript v12, the built-in operators are already generic, but we use them in this example for simplicity.

```res example
{/* this example purposefully has an error so it is not marked as an example */}
```res
type rec number<_> = Int(int): number<int> | Float(float): number<float>

let add = (type a, x: number<a>, y: number<a>): a =>
Expand Down Expand Up @@ -204,7 +211,8 @@ This API has a method for binding event handlers, `on`. This takes an event and
depending on which event we are binding to. A naive implementation might look similar to this, defining a
separate method for each stream event to wrap the unsafe version of `on`.

```res example
{/* TODO: fix this example, it has an error */}
```res
module Stream = {
type t

Expand Down Expand Up @@ -233,7 +241,8 @@ The real magic happens in the signature of `on`. Read it carefully, and then loo
follow how the type variables are getting filled in, write it out on paper what each type variable is equal
to if you need and it will soon become clear.

```res example
{/* TODO: fix this example, it has an error */}
```res

module Stream = {
type t<'a>
Expand Down
27 changes: 14 additions & 13 deletions docs/manual/module-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,33 @@ module Next = {
}

module Component: {
@react.component
let make: unit => Jsx.element
@react.component
let make: unit => Jsx.element
} = {
// Create a module that matches the module type expected by Next.MakeParams
module P = {
type t = {
tag: string,
item: string,
}
type t = {
tag: string,
item: string,
}
}

// Create a new module using the Params module we created and the Next.MakeParams module function
module Params = Next.MakeParams(P)

@react.component
let make = () => {

// Use the functions, values, or types created by the module function
let params = Params.useParams()

<div>
<p>
{React.string("Tag: " ++ params.tag /_ params is fully typed! _/)}
</p>
<p> {React.string("Item: " ++ params.item)} </p>
</div>
}
<div>
<p>
{React.string("Tag: " ++ params.tag /* params is fully typed! */)}
</p>
<p> {React.string("Item: " ++ params.item)} </p>
</div>
}
}

````
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/record.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can also nest definitions of records.

<CodeTab labels={["ReScript", "JS Output"]}>

```res prelude
```res example
type person = {
age: int,
name: string,
Expand Down Expand Up @@ -81,7 +81,7 @@ So if we in the example above ended up needing to refer to `person.notificationS

<CodeTab labels={["ReScript", "JS Output"]}>

```res prelude
```res example
type personNotificationSettings = {
sendEmails: bool,
allowPasswordLogin: bool,
Expand Down
6 changes: 3 additions & 3 deletions docs/react/hooks-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ module ThemedButton = {
| "light" | _ => ("#000000", "#eeeeee")
}

let style = ReactDOMStyle.make(~color, ~backgroundColor, ())

<button style> {React.string("I am a styled button!")} </button>
<button style={{color, backgroundColor}}>
{React.string("I am a styled button!")}
</button>
}
}

Expand Down
7 changes: 4 additions & 3 deletions docs/react/hooks-custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Let's go back to a previous example from our [React.useEffect section](./hooks-e

<CodeTab labels={["ReScript", "JS Output"]}>

```res example {16-31}
{/* TODO: fix this example */}
```res {16-31}
// FriendStatus.res

module ChatAPI = {
Expand Down Expand Up @@ -153,7 +154,7 @@ let make = (~friend: friend) => {
| Loading => "grey"
}

<li style={ReactDOMStyle.make(~color,())}>
<li style={{ color }}>
{React.string(friend.name)}
</li>
}
Expand Down Expand Up @@ -371,7 +372,7 @@ let make = (~friend: friend) => {
| Loading => "grey"
}

<li style={ReactDOMStyle.make(~color,())}>
<li style={{ color }}>
{React.string(friend.name)}
</li>
}
Expand Down
6 changes: 4 additions & 2 deletions docs/react/hooks-effect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ type state = Offline | Loading | Online

<CodeTab labels={["ReScript", "JS Output"]}>

```res example
{/* TODO: fix this example */}
```res
// FriendStatus.res
@react.component
let make = (~friendId: string) => {
Expand Down Expand Up @@ -281,7 +282,8 @@ When we render with count updated to 6, React will compare the items in the `[5]

This also works for effects that have a cleanup phase:

```res example
{/* TODO fix this example */}
```res
@react.component
let make = (~friendId: string) => {
let (state, setState) = React.useState(_ => Offline)
Expand Down
1 change: 1 addition & 0 deletions docs/react/hooks-ref.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let make = () => {
let textInput = React.useRef(Nullable.null)
let setTextInputRef = element => {
textInput.current = element;
None
}

let focusTextInput = _ => {
Expand Down
6 changes: 5 additions & 1 deletion docs/react/refs-and-the-dom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ let make = () => {
let textInput = React.useRef(Nullable.null)
let setTextInputRef = element => {
textInput.current = element
None
}

let focusTextInput = _ => {
Expand Down Expand Up @@ -269,7 +270,10 @@ module CustomTextInput = {
@react.component
let make = () => {
let textInput = React.useRef(Nullable.null)
let setInputRef = element => { textInput.current = element}
let setInputRef = element => {
textInput.current = element
None
}

<CustomTextInput setInputRef/>
}
Expand Down
24 changes: 4 additions & 20 deletions docs/react/styling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,11 @@ If they work in JS then they almost certainly work in ReScript. In the next few

## Inline Styles

This is the most basic form of styling, coming straight from the 90s. You can apply a `style` attribute to any DOM element with our `ReactDOM.Style.make` API:
This is the most basic form of styling, coming straight from the 90s. You can apply a `style` attribute to any DOM element using the `style` prop.

```res example
<div style={ReactDOM.Style.make(~color="#444444", ~fontSize="68px", ())} />
```

It's a [labeled](/docs/manual/latest/function#labeled-arguments) (therefore typed) function call that maps to the familiar style object `{color: '#444444', fontSize: '68px'}`. For every CSS attribute in the CSS specfication, there is a camelCased label in our `make` function.

**Note** that `make` returns an opaque `ReactDOM.Style.t` type that you can't read into. We also expose a `ReactDOM.Style.combine` that takes in two `style`s and combine them.

### Escape Hatch: `unsafeAddProp`

The above `Style.make` API will safely type check every style field! However, we might have missed some more esoteric fields. If that's the case, the type system will tell you that the field you're trying to add doesn't exist. To remediate this, we're exposing a `ReactDOM.Style.unsafeAddProp` to dangerously add a field to a style:

```res example
let style =
ReactDOM.Style.make(
~color="red",
~padding="10px",
(),
)->ReactDOM.Style.unsafeAddProp("-webkit-animation-name", "moveit")
let make = () =>
<div style={{ color: "#444444", fontSize: "68px"}} />
```

## Global CSS
Expand Down Expand Up @@ -173,7 +157,7 @@ Please note that this approach will not check for invalid css attribute names. I
@module("@emotion/css") external css: ReactDOM.Style.t => string = "css"

// Usage is slightly different (and probably less ergonomic)
let container = ReactDOM.Style.make(~padding="20px", ())->css;
let container = {padding: "20px"}->css

let app = <div
className={container}
Expand Down
Loading
Loading