-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make syntax highlighting work for signatures and examples
- Loading branch information
Showing
8 changed files
with
93 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
open Util.ReactStuff; | ||
|
||
type lang = [ | `Reason | `OCaml]; | ||
|
||
[@react.component] | ||
let make = (~children, ~lang=`Reason) => { | ||
let langStr = | ||
switch (lang) { | ||
| `Reason => "RE" | ||
| `OCaml => "ML" | ||
}; | ||
<div className="flex flex-col rounded-lg bg-main-black py-3 px-3 mt-10 overflow-x-auto"> | ||
let make = (~code: string, ~lang) => { | ||
let highlighted = HighlightJs.(highlight(~lang, ~value=code)->valueGet); | ||
|
||
let children = | ||
ReactDOMRe.createElementVariadic( | ||
"code", | ||
~props= | ||
ReactDOMRe.objToDOMProps({ | ||
"className": "hljs lang-" ++ lang, | ||
"dangerouslySetInnerHTML": { | ||
"__html": highlighted, | ||
}, | ||
}), | ||
[||], | ||
); | ||
|
||
<div | ||
className="flex flex-col rounded-lg bg-main-black py-3 px-3 mt-10 overflow-x-auto text-lighter-grey"> | ||
<div | ||
className="font-montserrat text-sm mb-3 font-bold text-primary-dark-10"> | ||
langStr->s | ||
</div> | ||
<div className="pl-3 text-base pb-4"> | ||
children | ||
{Js.String2.toUpperCase(lang)->s} | ||
</div> | ||
<div className="pl-5 text-base pb-4"> children </div> | ||
</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
open Util.ReactStuff; | ||
|
||
[@react.component] | ||
let make = (~children) => { | ||
<div className="font-bold"> children->s </div>; | ||
let make = (~code, ~lang) => { | ||
let highlighted = HighlightJs.(highlight(~lang, ~value=code)->valueGet); | ||
|
||
ReactDOMRe.createElementVariadic( | ||
"code", | ||
~props= | ||
ReactDOMRe.objToDOMProps({ | ||
"className": "font-bold hljs lang-" ++ lang, | ||
"dangerouslySetInnerHTML": { | ||
"__html": highlighted, | ||
}, | ||
}), | ||
[||], | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters