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.
git clone [email protected]:nostr-dev-kit/ndk-docs.git
cd ndk-docs
npm i
npm run dev
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.
.svx
file. e.g. From ndkEvent.svx
to ndkUserProfile.svx
+page.svelte
and ndkEvent.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';
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 the SectionHeader
component below). e.g. If you have an h2
section header on the page called "Create a user", the tableOfContents
variable should be {title: "Create a user", url: "#create-a-user"}
.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 sure h2
and h3
headings are set correctly so that the secondary nav works properly.
h2
and h3
headers in the .svx
file should be declared with this component instead of using the standard markdown ##
and ###
prefixes. NB: Use Markdown (#
) for the single h1
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.