on master help sign in
Revert "docs: add syntax highlighting"

This reverts commit 4f1c50e204a466232e8ba3937d511277d121cbe1.

commit75838a03166d063a85e06fd819875f58f49dfb11 authorMatilde Park <matilde@tlon.io> dateTue 29 Jun 2021, 18:26 (5 years ago) parentb90dd87
5 files changed+22−94
components/Markdown.js+2−14 content/docs/arvo/eyre/using-eyre.md+19−22 package-lock.json−54 package.json−3 styles/markdown.module.css+1−1
components/Markdown.js+2−14
@@ -2,16 +2,6 @@ import markdownStyles from "../styles/markdown.module.css";
22import unified from "unified";
33import parse from "remark-parse";
44import 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";
155import slug from "remark-slug";
166import heading from "remark-heading-id";
177
@@ -31,13 +21,11 @@ function Img({ src, children }) {
3121const options = {
3222 remarkReactComponents: {
3323 img: Img,
34− code: RemarkLowlight({ bash, sh, js, c, http }),
3524 // p: P,
3625 },
37− sanitize: merge(sanitizeGhSchema, {
26+ sanitize: {
3827 clobberPrefix: "",
39− attributes: { code: ["className"] },
40− }),
28+ },
4129};
4230
4331// 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):
3030```bash
3131curl -i localhost:8080/~/login -X POST -d "password=lidlut-tabwed-pillex-ridrup"
3232```
33−
3433Let's explain what this does:
3534
36−- `-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.
38−- `-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)
35+ - `-i` displays the headers, so that you can see the cookie that gets sent
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.
37+ - `-X POST` specifies that you are POSTing data, not GETting.
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)
4039
4140You should see the following:
4241
43−```http
42+```bash
4443HTTP/1.1 200 ok
4544Date: Sun, 01 Jan 2020 00:00:00 GMT
4645Connection: keep-alive
@@ -53,11 +52,11 @@ The `Date` and `set-cookie` will be slightly different of course.
5352
5453Take 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:
5554
56−- `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
58−- `0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg` is the actual authentication token.
55+ - `urbauth` is a prefix that Eyre uses to check for presence of authentication
56+ - `~zod` is the name of the ship you are logging in as
57+ - `0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg` is the actual authentication token.
5958
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.
6160
6261## Interacting with Eyre
6362
@@ -74,7 +73,7 @@ These can be used independently, i.e. you may choose to only send information or
7473
7574For this example, we will use the following channel:
7675
77−```bash
76+```
7877http://localhost:8080/~/channel/1601844290-ae45b
7978```
8079
@@ -136,23 +135,21 @@ This is all we need to send Urbit to say "On this URL through which I am sending
136135You 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:
137136
138137```js
139−const eventSource = new EventSource(
140− "http://localhost:8080/~/channel/1601844290-ae45b",
141− {
142− withCredentials: true, // Required, sends your cookie
143− }
144−);
145−
146−eventSource.addEventListener("message", function (event) {
138+const eventSource = new EventSource('http://localhost:8080/~/channel/1601844290-ae45b', {
139+ withCredentials: true // Required, sends your cookie
140+});
141+
142+eventSource.addEventListener('message', function (event) {
147143 ack(Number(event.lastEventId)); // See section below
148144 const payload = JSON.parse(event.data); // Data is sent in JSON format
149145 payload.id === event.lastEventId; // The SSE spec includes event IDs. This information is duplicated in the payload.
150146 const data = payload.json; // Beyond this, the actual data will vary between apps
151147});
152148
153−eventSource.addEventListener("error", function (event) {
149+eventSource.addEventListener('error', function (event) {
154150 handleError(event);
155151});
152+
156153```
157154
158155### Handling Received Events
@@ -169,7 +166,7 @@ Once you have received an event, it is expected that you will "ack" or "acknowle
169166
170167### Unsubscribing from Events
171168
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:
173170
174171```javascript
175172{
@@ -200,7 +197,7 @@ Scrying lets you see what an app has exposed at a particular path. It does not m
200197
201198It takes the form `{url}/~/scry/{app}{path}.{mark}`
202199
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.
204201
205202```bash
206203curl --header "Content-Type: application/json" \
package-lock.json−54
@@ -2367,11 +2367,6 @@
23672367 "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
23682368 "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
23692369 },
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− },
23752370 "define-properties": {
23762371 "version": "1.1.3",
23772372 "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
@@ -2688,14 +2683,6 @@
26882683 "reusify": "^1.0.4"
26892684 }
26902685 },
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− },
26992686 "file-type": {
27002687 "version": "10.11.0",
27012688 "resolved": "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz",
@@ -2738,11 +2725,6 @@
27382725 "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
27392726 "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
27402727 },
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− },
27462728 "fraction.js": {
27472729 "version": "4.1.1",
27482730 "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.1.tgz",
@@ -3061,11 +3043,6 @@
30613043 "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
30623044 "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
30633045 },
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− },
30693046 "hmac-drbg": {
30703047 "version": "1.0.1",
30713048 "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@@ -3589,15 +3566,6 @@
35893566 "js-tokens": "^3.0.0 || ^4.0.0"
35903567 }
35913568 },
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− },
36013569 "lru-cache": {
36023570 "version": "6.0.0",
36033571 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -4954,15 +4922,6 @@
49544922 "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
49554923 "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
49564924 },
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− },
49664925 "react-native-get-random-values": {
49674926 "version": "1.7.0",
49684927 "resolved": "https://registry.npmjs.org/react-native-get-random-values/-/react-native-get-random-values-1.7.0.tgz",
@@ -5027,11 +4986,6 @@
50274986 "unified": "^9.1.0"
50284987 }
50294988 },
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− },
50354989 "remark-heading-id": {
50364990 "version": "1.0.0",
50374991 "resolved": "https://registry.npmjs.org/remark-heading-id/-/remark-heading-id-1.0.0.tgz",
@@ -5069,14 +5023,6 @@
50695023 "mdast-util-to-hast": "^10.0.0"
50705024 }
50715025 },
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− },
50805026 "remark-slug": {
50815027 "version": "6.0.0",
50825028 "resolved": "https://registry.npmjs.org/remark-slug/-/remark-slug-6.0.0.tgz",
package.json−3
@@ -13,7 +13,6 @@
1313 "@iarna/toml": "^2.2.5",
1414 "@netlify/plugin-nextjs": "^3.4.2",
1515 "classnames": "^2.3.1",
16− "deepmerge": "^4.2.2",
1716 "fuzzy-search": "^3.2.1",
1817 "gray-matter": "^4.0.3",
1918 "next": "10.2.3",
@@ -21,12 +20,10 @@
2120 "react-dom": "17.0.2",
2221 "react-hotkeys": "^2.0.0",
2322 "remark": "^13.0.0",
24− "remark-code-blocks": "^2.0.1",
2523 "remark-heading-id": "^1.0.0",
2624 "remark-html": "^13.0.1",
2725 "remark-parse": "^9.0.0",
2826 "remark-react": "^8.0.0",
29− "remark-react-lowlight": "^0.7.0",
3027 "remark-slug": "^6.0.0",
3128 "toml": "^3.0.0",
3229 "unified": "^9.2.1"
styles/markdown.module.css+1−1
@@ -63,7 +63,7 @@
6363}
6464
6565.markdown pre {
66− @apply p-8 bg-wall rounded-lg overflow-x-scroll;
66+ @apply p-8 bg-wall rounded-lg;
6767}
6868
6969.markdown code {