on master help sign in
Revert "docs: add syntax highlighting"
75838a0Matilde Park
components/Markdown.js+2−14
@@ -2,16 +2,6 @@ import markdownStyles from "../styles/markdown.module.css";
2import unified from "unified";
2import unified from "unified";
3import parse from "remark-parse";
3import parse from "remark-parse";
4import remark2react from "remark-react";
4import remark2react from "remark-react";
5−import RemarkLowlight from "remark-react-lowlight";
6−import codeblocks from "remark-code-blocks";
7−import bash from "highlight.js/lib/languages/bash";
8−import sh from "highlight.js/lib/languages/shell";
9−import js from "highlight.js/lib/languages/javascript";
10−import c from "highlight.js/lib/languages/c";
11−import http from "highlight.js/lib/languages/http";
12−import sanitizeGhSchema from "hast-util-sanitize/lib/github.json";
13−import merge from "deepmerge";
14−import "highlight.js/styles/idea.css";
15import slug from "remark-slug";
5import slug from "remark-slug";
16import heading from "remark-heading-id";
6import heading from "remark-heading-id";
17
7
@@ -31,13 +21,11 @@ function Img({ src, children }) {
31const options = {
21const options = {
32 remarkReactComponents: {
22 remarkReactComponents: {
33 img: Img,
23 img: Img,
34− code: RemarkLowlight({ bash, sh, js, c, http }),
35 // p: P,
24 // p: P,
36 },
25 },
37− sanitize: merge(sanitizeGhSchema, {
26+ sanitize: {
38 clobberPrefix: "",
27 clobberPrefix: "",
39− attributes: { code: ["className"] },
40− }),
28+ },
41};
29};
42
30
43// Converts markdown strings into markdown HTML/React components
31// Converts markdown strings into markdown HTML/React components
content/docs/arvo/eyre/using-eyre.md+19−22
@@ -30,17 +30,16 @@ Run this code in your bash terminal (requires cURL):
30```bash
30```bash
31curl -i localhost:8080/~/login -X POST -d "password=lidlut-tabwed-pillex-ridrup"
31curl -i localhost:8080/~/login -X POST -d "password=lidlut-tabwed-pillex-ridrup"
32```
32```
33−
34Let's explain what this does:
33Let's explain what this does:
35
34
36−- `-i` displays the headers, so that you can see the cookie that gets sent
35+ - `-i` displays the headers, so that you can see the cookie that gets sent
37−- `localhost:8080/~/login` is the URL to which you are POSTing. You will note this is also the URL you visit when you log into Landscape.
36+ - `localhost:8080/~/login` is the URL to which you are POSTing. You will note this is also the URL you visit when you log into Landscape.
38−- `-X POST` specifies that you are POSTing data, not GETting.
37+ - `-X POST` specifies that you are POSTing data, not GETting.
39−- `-d "password=lidlut-tabwed-pillex-ridrup"` specifies the code for your Urbit that we retrieved above. It is sent as form data, as if it were sent from an HTML form input field (which it is in Landscape)
38+ - `-d "password=lidlut-tabwed-pillex-ridrup"` specifies the code for your Urbit that we retrieved above. It is sent as form data, as if it were sent from an HTML form input field (which it is in Landscape)
40
39
41You should see the following:
40You should see the following:
42
41
43−```http
42+```bash
44HTTP/1.1 200 ok
43HTTP/1.1 200 ok
45Date: Sun, 01 Jan 2020 00:00:00 GMT
44Date: Sun, 01 Jan 2020 00:00:00 GMT
46Connection: keep-alive
45Connection: keep-alive
@@ -53,11 +52,11 @@ The `Date` and `set-cookie` will be slightly different of course.
53
52
54Take a look at the `set-cookie` line. This is now your session authentication, and will need to be sent with any future requests. It consists of three parts:
53Take a look at the `set-cookie` line. This is now your session authentication, and will need to be sent with any future requests. It consists of three parts:
55
54
56−- `urbauth` is a prefix that Eyre uses to check for presence of authentication
55+ - `urbauth` is a prefix that Eyre uses to check for presence of authentication
57−- `~zod` is the name of the ship you are logging in as
56+ - `~zod` is the name of the ship you are logging in as
58−- `0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg` is the actual authentication token.
57+ - `0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg` is the actual authentication token.
59
58
60−At present there is no way to separate these parts — you must pass a cookie _as_ a cookie. This string must be in the `Cookie` header. The `set-cookie` header is only used for this request upon response. It is what browsers expect when receiving a cookie.
59+At present there is no way to separate these parts — you must pass a cookie *as* a cookie. This string must be in the `Cookie` header. The `set-cookie` header is only used for this request upon response. It is what browsers expect when receiving a cookie.
61
60
62## Interacting with Eyre
61## Interacting with Eyre
63
62
@@ -74,7 +73,7 @@ These can be used independently, i.e. you may choose to only send information or
74
73
75For this example, we will use the following channel:
74For this example, we will use the following channel:
76
75
77−```bash
76+```
78http://localhost:8080/~/channel/1601844290-ae45b
77http://localhost:8080/~/channel/1601844290-ae45b
79```
78```
80
79
@@ -136,23 +135,21 @@ This is all we need to send Urbit to say "On this URL through which I am sending
136You should be able to send this information if you were able to send the above cURL example. However, we now need to be able to listen to the SSEs. The `EventSource` object is available for JavaScript in the browser context, as this is why SSEs were invented, but there should be a library for it in your chosen language. Take a look at a Browser JavaScript example:
135You should be able to send this information if you were able to send the above cURL example. However, we now need to be able to listen to the SSEs. The `EventSource` object is available for JavaScript in the browser context, as this is why SSEs were invented, but there should be a library for it in your chosen language. Take a look at a Browser JavaScript example:
137
136
138```js
137```js
139−const eventSource = new EventSource(
140− "http://localhost:8080/~/channel/1601844290-ae45b",
138+const eventSource = new EventSource('http://localhost:8080/~/channel/1601844290-ae45b', {
141− {
142− withCredentials: true, // Required, sends your cookie
139+ withCredentials: true // Required, sends your cookie
143− }
144−);
140+});
145−
141+
146−eventSource.addEventListener("message", function (event) {
142+eventSource.addEventListener('message', function (event) {
147 ack(Number(event.lastEventId)); // See section below
143 ack(Number(event.lastEventId)); // See section below
148 const payload = JSON.parse(event.data); // Data is sent in JSON format
144 const payload = JSON.parse(event.data); // Data is sent in JSON format
149 payload.id === event.lastEventId; // The SSE spec includes event IDs. This information is duplicated in the payload.
145 payload.id === event.lastEventId; // The SSE spec includes event IDs. This information is duplicated in the payload.
150 const data = payload.json; // Beyond this, the actual data will vary between apps
146 const data = payload.json; // Beyond this, the actual data will vary between apps
151});
147});
152
148
153−eventSource.addEventListener("error", function (event) {
149+eventSource.addEventListener('error', function (event) {
154 handleError(event);
150 handleError(event);
155});
151});
152+
156```
153```
157
154
158### Handling Received Events
155### Handling Received Events
@@ -169,7 +166,7 @@ Once you have received an event, it is expected that you will "ack" or "acknowle
169
166
170### Unsubscribing from Events
167### Unsubscribing from Events
171
168
172−You may want to stop receiving events from a particular app path, but you don't want to close the channel altogether yet. Let's look at how to do that. Take a look at the example for subscribing. We sent that message with `id: 2`. We will use that ID to cancel the relevant subscription:
169+You may want to stop receiving events from a particular app path, but you don't want to close the channel altogether yet. Let's look at how to do that. Take a look at the example for subscribing. We sent that message with `id: 2`. We will use that ID to cancel the relevant subscription:
173
170
174```javascript
171```javascript
175{
172{
@@ -200,7 +197,7 @@ Scrying lets you see what an app has exposed at a particular path. It does not m
200
197
201It takes the form `{url}/~/scry/{app}{path}.{mark}`
198It takes the form `{url}/~/scry/{app}{path}.{mark}`
202
199
203−Let's get the base hash of our fakezod in the same way that Landscape does it.
200+ Let's get the base hash of our fakezod in the same way that Landscape does it.
204
201
205```bash
202```bash
206curl --header "Content-Type: application/json" \
203curl --header "Content-Type: application/json" \
package-lock.json−54
@@ -2367,11 +2367,6 @@
2367 "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
2367 "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
2368 "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
2368 "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
2369 },
2369 },
2370− "deepmerge": {
2371− "version": "4.2.2",
2372− "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
2373− "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg=="
2374− },
2375 "define-properties": {
2370 "define-properties": {
2376 "version": "1.1.3",
2371 "version": "1.1.3",
2377 "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
2372 "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
@@ -2688,14 +2683,6 @@
2688 "reusify": "^1.0.4"
2683 "reusify": "^1.0.4"
2689 }
2684 }
2690 },
2685 },
2691− "fault": {
2692− "version": "1.0.4",
2693− "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz",
2694− "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
2695− "requires": {
2696− "format": "^0.2.0"
2697− }
2698− },
2699 "file-type": {
2686 "file-type": {
2700 "version": "10.11.0",
2687 "version": "10.11.0",
2701 "resolved": "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz",
2688 "resolved": "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz",
@@ -2738,11 +2725,6 @@
2738 "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
2725 "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
2739 "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
2726 "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
2740 },
2727 },
2741− "format": {
2742− "version": "0.2.2",
2743− "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz",
2744− "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs="
2745− },
2746 "fraction.js": {
2728 "fraction.js": {
2747 "version": "4.1.1",
2729 "version": "4.1.1",
2748 "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.1.tgz",
2730 "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.1.tgz",
@@ -3061,11 +3043,6 @@
3061 "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
3043 "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
3062 "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
3044 "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
3063 },
3045 },
3064− "highlight.js": {
3065− "version": "10.7.3",
3066− "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
3067− "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="
3068− },
3069 "hmac-drbg": {
3046 "hmac-drbg": {
3070 "version": "1.0.1",
3047 "version": "1.0.1",
3071 "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
3048 "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@@ -3589,15 +3566,6 @@
3589 "js-tokens": "^3.0.0 || ^4.0.0"
3566 "js-tokens": "^3.0.0 || ^4.0.0"
3590 }
3567 }
3591 },
3568 },
3592− "lowlight": {
3593− "version": "1.20.0",
3594− "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz",
3595− "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==",
3596− "requires": {
3597− "fault": "^1.0.0",
3598− "highlight.js": "~10.7.0"
3599− }
3600− },
3601 "lru-cache": {
3569 "lru-cache": {
3602 "version": "6.0.0",
3570 "version": "6.0.0",
3603 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
3571 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -4954,15 +4922,6 @@
4954 "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
4922 "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
4955 "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
4923 "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
4956 },
4924 },
4957− "react-lowlight": {
4958− "version": "1.1.1",
4959− "resolved": "https://registry.npmjs.org/react-lowlight/-/react-lowlight-1.1.1.tgz",
4960− "integrity": "sha512-aYUue4qlOOHEa0y4MXuUHOxe9oaO5fFnnTE5Nkw+euNK123+ntFgpnAkPNhbcvkNAI1kglLn+D6SeYNrCWsCIA==",
4961− "requires": {
4962− "lowlight": "^1.0.0",
4963− "prop-types": "^15.5.8"
4964− }
4965− },
4966 "react-native-get-random-values": {
4925 "react-native-get-random-values": {
4967 "version": "1.7.0",
4926 "version": "1.7.0",
4968 "resolved": "https://registry.npmjs.org/react-native-get-random-values/-/react-native-get-random-values-1.7.0.tgz",
4927 "resolved": "https://registry.npmjs.org/react-native-get-random-values/-/react-native-get-random-values-1.7.0.tgz",
@@ -5027,11 +4986,6 @@
5027 "unified": "^9.1.0"
4986 "unified": "^9.1.0"
5028 }
4987 }
5029 },
4988 },
5030− "remark-code-blocks": {
5031− "version": "2.0.1",
5032− "resolved": "https://registry.npmjs.org/remark-code-blocks/-/remark-code-blocks-2.0.1.tgz",
5033− "integrity": "sha512-eZ6vfhv6Sv4TNbNYG6kG3ApQp6MRYc9fT4NT9QBPkuYQf51+TAbuMqApZdJdrsjeI9O8TP7noZF1KbadbLk5Lg=="
5034− },
5035 "remark-heading-id": {
4989 "remark-heading-id": {
5036 "version": "1.0.0",
4990 "version": "1.0.0",
5037 "resolved": "https://registry.npmjs.org/remark-heading-id/-/remark-heading-id-1.0.0.tgz",
4991 "resolved": "https://registry.npmjs.org/remark-heading-id/-/remark-heading-id-1.0.0.tgz",
@@ -5069,14 +5023,6 @@
5069 "mdast-util-to-hast": "^10.0.0"
5023 "mdast-util-to-hast": "^10.0.0"
5070 }
5024 }
5071 },
5025 },
5072− "remark-react-lowlight": {
5073− "version": "0.7.0",
5074− "resolved": "https://registry.npmjs.org/remark-react-lowlight/-/remark-react-lowlight-0.7.0.tgz",
5075− "integrity": "sha512-gSs9vgln8CXh3Vi3QLys+djrEz6eKqPX3XDQRbGi804BDC4wlP0cxizvQg2ALDDWlh+be6g+gfseyXwA1AOmug==",
5076− "requires": {
5077− "react-lowlight": "^1.0.4"
5078− }
5079− },
5080 "remark-slug": {
5026 "remark-slug": {
5081 "version": "6.0.0",
5027 "version": "6.0.0",
5082 "resolved": "https://registry.npmjs.org/remark-slug/-/remark-slug-6.0.0.tgz",
5028 "resolved": "https://registry.npmjs.org/remark-slug/-/remark-slug-6.0.0.tgz",
package.json−3
@@ -13,7 +13,6 @@
13 "@iarna/toml": "^2.2.5",
13 "@iarna/toml": "^2.2.5",
14 "@netlify/plugin-nextjs": "^3.4.2",
14 "@netlify/plugin-nextjs": "^3.4.2",
15 "classnames": "^2.3.1",
15 "classnames": "^2.3.1",
16− "deepmerge": "^4.2.2",
17 "fuzzy-search": "^3.2.1",
16 "fuzzy-search": "^3.2.1",
18 "gray-matter": "^4.0.3",
17 "gray-matter": "^4.0.3",
19 "next": "10.2.3",
18 "next": "10.2.3",
@@ -21,12 +20,10 @@
21 "react-dom": "17.0.2",
20 "react-dom": "17.0.2",
22 "react-hotkeys": "^2.0.0",
21 "react-hotkeys": "^2.0.0",
23 "remark": "^13.0.0",
22 "remark": "^13.0.0",
24− "remark-code-blocks": "^2.0.1",
25 "remark-heading-id": "^1.0.0",
23 "remark-heading-id": "^1.0.0",
26 "remark-html": "^13.0.1",
24 "remark-html": "^13.0.1",
27 "remark-parse": "^9.0.0",
25 "remark-parse": "^9.0.0",
28 "remark-react": "^8.0.0",
26 "remark-react": "^8.0.0",
29− "remark-react-lowlight": "^0.7.0",
30 "remark-slug": "^6.0.0",
27 "remark-slug": "^6.0.0",
31 "toml": "^3.0.0",
28 "toml": "^3.0.0",
32 "unified": "^9.2.1"
29 "unified": "^9.2.1"
styles/markdown.module.css+1−1
@@ -63,7 +63,7 @@
63}
63}
64
64
65.markdown pre {
65.markdown pre {
66− @apply p-8 bg-wall rounded-lg overflow-x-scroll;
66+ @apply p-8 bg-wall rounded-lg;
67}
67}
68
68
69.markdown code {
69.markdown code {