Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reference docs migration #1702

Merged
merged 21 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ docs/build/cross-chain/awm/evm-integration.md
docs/build/cross-chain/awm/relayer.md
docs/learn/acp.md

# AvalancheGo API from GH repo via docusaurus-plugin-remote-content
docs/reference/avalanchego/p-chain/api.md
docs/reference/avalanchego/x-chain/api.md
docs/reference/avalanchego/admin-api.md
docs/reference/avalanchego/health-api.md
docs/reference/avalanchego/info-api.md
docs/reference/avalanchego/metrics-api.md
docs/reference/avalanchego/keystore-api.md
docs/reference/avalanchego/index-api.md
docs/nodes/configure/avalanchego-config-flags.md
docs/nodes/configure/subnet-configs.md

# Misc
.DS_Store
.env.local
Expand Down
283 changes: 277 additions & 6 deletions configs/remoteContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,35 @@ function insertLinesAfterFirstLine(content, newLines) {
return lines.join("\n");
}

let newLines = [
let teleporterCourse = [
`
:::info
Dive deeper into Teleporter and kickstart your journey in building cross-chain dApps by enrolling in our [<ins>Teleporter course</ins>](https://academy.avax.network/course/teleporter).
:::
`,
];

// Function to insert link to source doc in the content
function insertSourceDocLink(content, sourceDocUrl) {
const lines = content.split("\n");
const h1Index = lines.findIndex((line) => line.trim().startsWith("#"));
if (h1Index !== -1) {
const tip = [
" :::tip",
` This page was generated by a plugin that directly references this [file](${sourceDocUrl})`,
" in the AvalancheGo GitHub repository.",
" :::",
];
lines.splice(h1Index + 1, 0, ...tip); // Insert the admonition block after the h1
} else {
console.error(
"No first-level heading found in the Markdown content. Admonition block not inserted."
);
}

return lines.join("\n");
}

const remoteContent = [
[
"docusaurus-plugin-remote-content",
Expand Down Expand Up @@ -111,7 +132,7 @@ ${updatedContent}`,

const newContent = insertLinesAfterFirstLine(
updatedContent,
newLines
teleporterCourse
);

return {
Expand Down Expand Up @@ -150,7 +171,7 @@ ${newContent}`,

const newContent = insertLinesAfterFirstLine(
updatedContent,
newLines
teleporterCourse
);

return {
Expand Down Expand Up @@ -224,7 +245,7 @@ ${updatedContent}`,

const newContent = insertLinesAfterFirstLine(
updatedContent,
newLines
teleporterCourse
);

return {
Expand Down Expand Up @@ -263,7 +284,7 @@ ${newContent}`,

const newContent = insertLinesAfterFirstLine(
updatedContent,
newLines
teleporterCourse
);

return {
Expand Down Expand Up @@ -302,7 +323,7 @@ ${newContent}`,

const newContent = insertLinesAfterFirstLine(
updatedContent,
newLines
teleporterCourse
);

return {
Expand Down Expand Up @@ -388,6 +409,256 @@ ${updatedContent}`,
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/p-chain/api.md
name: "p-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/vms/platformvm/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/p-chain/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/vms/platformvm/service.md"
);
return {
filename: "api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/x-chain/api.md
name: "x-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/vms/avm/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/x-chain/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/vms/avm/service.md"
);
return {
filename: "api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/admin-api.md
name: "admin-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/api/admin/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/api/admin/service.md"
);
return {
filename: "admin-api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/health-api.md
name: "health-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/api/health/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/api/health/service.md"
);
return {
filename: "health-api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/info-api.md
name: "info-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/api/info/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/api/info/service.md"
);
return {
filename: "info-api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/metrics-api.md
name: "metrics-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/api/metrics/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/api/metrics/service.md"
);
return {
filename: "metrics-api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/keystore-api.md
name: "keystore-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/api/keystore/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/api/keystore/service.md"
);
return {
filename: "keystore-api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/reference/index-api.md
name: "index-api",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/indexer/",
documents: ["service.md"],
outDir: "docs/reference/avalanchego/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("service")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/indexer/service.md"
);
return {
filename: "index-api.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/nodes/configure/avalanchego-config-flags.md
name: "avalanchego-config-flags",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/config/",
documents: ["config.md"],
outDir: "docs/nodes/configure/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("config")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/config/config.md"
);
return {
filename: "avalanchego-config-flags.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
[
"docusaurus-plugin-remote-content",
{
// /docs/nodes/configure/subnet-configs.md
name: "subnet-configs",
sourceBaseUrl:
"https://github.com/raw/ava-labs/avalanchego/meag/docs-format/subnets/",
documents: ["config.md"],
outDir: "docs/nodes/configure/",
// change filename and correct links
modifyContent(filename, content) {
if (filename.includes("config")) {
const newContent = insertSourceDocLink(
content,
"https://github.com/ava-labs/avalanchego/tree/master/subnets/config.md"
);
return {
filename: "subnet-configs.md",
content: `${newContent}`,
};
}
return undefined;
},
},
],
];

module.exports = remoteContent;
2 changes: 1 addition & 1 deletion docs/build/dapp/advanced/integrate-exchange.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ a JSON file whose keys and values are option names and values.
Individual chains, including the C-Chain, have their own configuration options
which are separate from the node-level options. These can also be specified in a
config file. For more details, see
[here](/nodes/configure/chain-config-flags.md#c-chain-configs).
[here](/nodes/configure/chain-configs/C.md).

The C-Chain config file should be at
`$HOME/.avalanchego/configs/chains/C/config.json`. You can also tell AvalancheGo
Expand Down
10 changes: 5 additions & 5 deletions docs/build/dapp/launch-dapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ default values.

On the other hand, you will most likely need to adjust C-Chain configuration to
suit your intended use. You can look up complete configuration options for
C-Chain [here](/nodes/configure/chain-config-flags.md#c-chain-configs) as well
C-Chain [here](/nodes/configure/chain-configs/C.md) as well
as the default configuration. Note that only the options that are different from
their default values need to be included in the config file.

Expand Down Expand Up @@ -169,7 +169,7 @@ APIs as well as default EVM APIs:
}
```

Default config values for the C-Chain can be seen [here](/nodes/configure/chain-config-flags.md#c-chain-configs).
Default config values for the C-Chain can be seen [here](/nodes/configure/chain-configs/C.md).

### Running a Local Test Network

Expand Down Expand Up @@ -217,9 +217,9 @@ API](https://eth.wiki/json-rpc/API).

For development purposes, you will need test tokens. Avalanche has a
[Faucet](https://faucet.avax.network/) that drips test tokens to the address of
your choice. If you already have an AVAX balance greater than zero on Mainnet,
paste your C-Chain address there, and request test tokens. Otherwise,
please request a faucet coupon on
your choice. If you already have an AVAX balance greater than zero on Mainnet,
paste your C-Chain address there, and request test tokens. Otherwise,
please request a faucet coupon on
[Guild](https://guild.xyz/avalanche). Admins and mods on the official [Discord](https://discord.com/invite/RwXY7P6)
can provide testnet AVAX if developers are unable to obtain it from the other two options.

Expand Down
Loading
Loading