This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
152 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
html/ |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
editLink: false | ||
--- | ||
|
||
# IPLD Specifications | ||
|
||
Specifications for the Inter-planetary Linked Data (IPLD) project: | ||
|
||
* **[IPLD Schemas](./schemas/)** | ||
|
||
See more or contribute on [GitHub](https://github.com/ipld/specs/). |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require('./highlight') | ||
|
||
function linkfix (md) { | ||
const defaultRender = md.renderer.rules.link_open | ||
|
||
md.renderer.rules.link_open = function (tokens, idx, options, env, self) { | ||
const hrefIndex = tokens[idx].attrIndex('href'); | ||
if (hrefIndex > -1) { | ||
const href = tokens[idx].attrs[hrefIndex][1] | ||
if (/\.(ipldsch|json)$/.test(href)) { | ||
tokens[idx].attrs[hrefIndex][1] = `${href}.md` | ||
} | ||
} | ||
|
||
return defaultRender(tokens, idx, options, env, self) | ||
} | ||
} | ||
|
||
module.exports = { | ||
title: 'IPLD Specifications', | ||
description: 'Specifications for the Inter-planetary Linked Data project', | ||
base: '/specs/', | ||
themeConfig: { | ||
repo: 'ipld/specs', | ||
editLinks: true, | ||
editLinkText: 'Edit this page on GitHub', | ||
lastUpdated: 'Last Updated', | ||
smoothScroll: true, | ||
nav: [ | ||
{ text: 'Home', link: '/' }, | ||
{ text: 'IPLD Schemas', link: '/schemas/' } | ||
], | ||
sidebar: { | ||
'/schemas/': [{ | ||
title: 'IPLD Schemas', | ||
collapsable: false, | ||
sidebarDepth: 2, | ||
children: [ | ||
['goals', 'Goals'], | ||
['feature-summary', 'Feature Summary'], | ||
['introduction', 'Introduction'], | ||
['authoring-guide', 'Authoring Guide'], | ||
'links', | ||
'schema-kinds', | ||
['representations', 'Representations'], | ||
['advanced-layouts', 'Advanced Layouts'] | ||
] | ||
}] | ||
} | ||
}, | ||
extendMarkdown: md => { | ||
// use more markdown-it plugins! | ||
md.use(linkfix) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// this require is awkward but technically the proper way to find the 'prismjs' | ||
// that's used by vuepress -> @vuepress/markdown -> prismjs | ||
const prism = require( | ||
require.resolve('prismjs', | ||
require.resolve('@vuepress/markdown', | ||
require.resolve('vuepress')))) | ||
|
||
prism.languages.ipldsch = { | ||
typedef: { | ||
pattern: /^[ \t]*(?:type|advanced)[ \t][A-Z](_?[A-Za-z0-9])*\b/m, | ||
inside: { | ||
keyword: /^[ \t]*(type|advanced)/m, | ||
'class-name': /[\w]+$/ | ||
} | ||
}, | ||
keyword: /\b(?:bool|int|float|string|bytes|null|nullable|optional)\b/, | ||
builtin: /\b(struct|union|enum)(?=[ \t]*\{)\b/, | ||
representation: { | ||
pattern: /^}[ \t]representation\b/m, | ||
inside: { | ||
builtin: /representation/ | ||
} | ||
}, | ||
operator: /=/, | ||
number: /\b-?\d+\.?\d*(?:e[+-]?\d+)?\b/i, | ||
punctuation: /[(){}:[\]\|&]/, | ||
string: { | ||
pattern: /(")(?:\\[\s\S]|(?!\1)[^\\])*\1/, | ||
greedy: true | ||
}, | ||
comment: { | ||
pattern: /(^|[^"])#.*/, | ||
lookbehind: true, | ||
greedy: true | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div[class~="language-ipldsch"]::before { | ||
content: "ipld schema"; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"scripts": { | ||
"prepare:base": "rm -rf html && mkdir html && cp -a .vuepress/ html/.vuepress/ && mv html/.vuepress/README.md html/", | ||
"prepare:content": "cp -a schemas/ html/schemas/", | ||
"prepare:ipldsch": "cd html && find . -name \\*.ipldsch -exec sh -c \"echo '---\\neditLink: false\\n---\\n\\n\\`\\`\\`ipldsch' > {}.md && cat {} >> {}.md && echo '\\`\\`\\`' >> {}.md\" \\;", | ||
"prepare:json": "find html/ -name \\*.json -exec sh -c \"echo '---\\neditLink: false\\n---\\n\\n\\`\\`\\`json' > {}.md && cat {} >> {}.md && echo '\\`\\`\\`' >> {}.md\" \\;", | ||
"build:vue": "vuepress build html --no-cache", | ||
"build": "set -e; for t in prepare:base prepare:content prepare:ipldsch prepare:json build:vue; do npm run $t; done" | ||
}, | ||
"dependencies": { | ||
"vuepress": "^1.2.0" | ||
} | ||
} |
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