This is the repository for the documentation that lives will live at ndk.fyi.
NDK (Nostr Development Kit) is a tool kit for building Nostr apps. It abstracts much of the complexity away and is built to help maintain and encourage Nostr's decentralized nature.
- Clone this repo
git clone git@github.com:nostr-dev-kit/ndk-docs.git
- Change into the directory
cd ndk-docs
- Install dependencies
npm i
- Run the server
npm run dev
- NDK is still under heavy development. Expect these docs to change regularly.
- These docs will remain english only for the foreseeable future. While translations would be great (and we'll get there in the future), for now we'll focus on making sure we have a single complete set of documentation.
- This site is built with the Svelte framework using typescript.
- First and foremost we need to get a v1 in place. There are sort of docs here. They are auto-generated and thus, cannot be trusted.
- We need to build out docs pages for all the major classes, enums, and interfaces in NDK.
Svelte page routing is dependent on folder structure. Any folder under the /src/routes/
directory will generate a route and Svelte will look for a +page.svelte
file in each of those directories to know what to render.
There is a reference page for NDKEvent
in this repo already /src/routes/classes/ndkEvent/
. Pages are generated from two different files.
-
+page.svelte
file is where you define the table of contents links. You'll need to update three things for new pages.- The filename of the
.svx
file. e.g. FromndkEvent.svx
tondkUserProfile.svx
- The import statement. e.g. if you copy
+page.svelte
andndkEvent.svx
from/src/routes/ndkEvent/
to a new directory at/src/routes/ndkUserProfile
, you'll need to change:
import MarkdownContent from './ndkEvent.svx';
to
import MarkdownContent from './ndkUserProfile.svx';
- The
tableOfContents
variable. This variable generates the secondary nav on the right side of the page. The values should be formatted based on the section titles on the page (see more on theSectionHeader
component below). e.g. If you have anh2
section header on the page called "Create a user", thetableOfContents
variable should be{title: "Create a user", url: "#create-a-user"}
.
- The filename of the
-
ndk<NDKClassName>.svx
file is a hybrid Svelte + Markdown file where the main page contents live. Aside from copying/writing the content for the page in markdown, you'll need to make sureh2
andh3
headings are set correctly so that the secondary nav works properly.h2
andh3
headers in the.svx
file should be declared with this component instead of using the standard markdown##
and###
prefixes. NB: Use Markdown (#
) for the singleh1
page title at the top of the page.
// For h2 headers <SectionHeader title="The section title" /> // For h3 subheaders <SectionHeader title="The sub-section title" subheader={true} />
-
Lastly, once you're page is ready, add it to the
navLinks
variable at the top of the/src/components/Sidebar.svelte
file.
Because NDK is still under heavy development, you're guaranteed to find things that are incorrect in the generated docs that currently exist. Read those with a critical eye and surface any questions or confusions in Github issues on this repo.