Skip to content

Commit

Permalink
Deploying to gh-pages from @ 8482ff0 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesLoder committed Aug 5, 2024
1 parent 8127745 commit d327e81
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .astro/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"_variables": {
"lastUpdateCheck": 1720661981335
}
}
206 changes: 206 additions & 0 deletions .astro/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
declare module 'astro:content' {
interface Render {
'.mdx': Promise<{
Content: import('astro').MarkdownInstance<{}>['Content'];
headings: import('astro').MarkdownHeading[];
remarkPluginFrontmatter: Record<string, any>;
}>;
}
}

declare module 'astro:content' {
interface Render {
'.md': Promise<{
Content: import('astro').MarkdownInstance<{}>['Content'];
headings: import('astro').MarkdownHeading[];
remarkPluginFrontmatter: Record<string, any>;
}>;
}
}

declare module 'astro:content' {
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;

export type CollectionKey = keyof AnyEntryMap;
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;

export type ContentCollectionKey = keyof ContentEntryMap;
export type DataCollectionKey = keyof DataEntryMap;

type AllValuesOf<T> = T extends any ? T[keyof T] : never;
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
ContentEntryMap[C]
>['slug'];

export function getEntryBySlug<
C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}),
>(
collection: C,
// Note that this has to accept a regular string too, for SSR
entrySlug: E
): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;

export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
collection: C,
entryId: E
): Promise<CollectionEntry<C>>;

export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
collection: C,
filter?: (entry: CollectionEntry<C>) => entry is E
): Promise<E[]>;
export function getCollection<C extends keyof AnyEntryMap>(
collection: C,
filter?: (entry: CollectionEntry<C>) => unknown
): Promise<CollectionEntry<C>[]>;

export function getEntry<
C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}),
>(entry: {
collection: C;
slug: E;
}): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
export function getEntry<
C extends keyof DataEntryMap,
E extends keyof DataEntryMap[C] | (string & {}),
>(entry: {
collection: C;
id: E;
}): E extends keyof DataEntryMap[C]
? Promise<DataEntryMap[C][E]>
: Promise<CollectionEntry<C> | undefined>;
export function getEntry<
C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}),
>(
collection: C,
slug: E
): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
export function getEntry<
C extends keyof DataEntryMap,
E extends keyof DataEntryMap[C] | (string & {}),
>(
collection: C,
id: E
): E extends keyof DataEntryMap[C]
? Promise<DataEntryMap[C][E]>
: Promise<CollectionEntry<C> | undefined>;

/** Resolve an array of entry references from the same collection */
export function getEntries<C extends keyof ContentEntryMap>(
entries: {
collection: C;
slug: ValidContentEntrySlug<C>;
}[]
): Promise<CollectionEntry<C>[]>;
export function getEntries<C extends keyof DataEntryMap>(
entries: {
collection: C;
id: keyof DataEntryMap[C];
}[]
): Promise<CollectionEntry<C>[]>;

export function reference<C extends keyof AnyEntryMap>(
collection: C
): import('astro/zod').ZodEffects<
import('astro/zod').ZodString,
C extends keyof ContentEntryMap
? {
collection: C;
slug: ValidContentEntrySlug<C>;
}
: {
collection: C;
id: keyof DataEntryMap[C];
}
>;
// Allow generic `string` to avoid excessive type errors in the config
// if `dev` is not running to update as you edit.
// Invalid collection names will be caught at build time.
export function reference<C extends string>(
collection: C
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;

type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
>;

type ContentEntryMap = {
"docs": {
"api/README.md": {
id: "api/README.md";
slug: "api/readme";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"api/classes/Schema.md": {
id: "api/classes/Schema.md";
slug: "api/classes/schema";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"api/classes/Text.md": {
id: "api/classes/Text.md";
slug: "api/classes/text";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"api/functions/remove.md": {
id: "api/functions/remove.md";
slug: "api/functions/remove";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"api/functions/sequence.md": {
id: "api/functions/sequence.md";
slug: "api/functions/sequence";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"api/functions/transliterate.md": {
id: "api/functions/transliterate.md";
slug: "api/functions/transliterate";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"api/interfaces/RemoveOptions.md": {
id: "api/interfaces/RemoveOptions.md";
slug: "api/interfaces/removeoptions";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".md"] };
"getting-started/quick-start.mdx": {
id: "getting-started/quick-start.mdx";
slug: "getting-started/quick-start";
body: string;
collection: "docs";
data: InferEntrySchema<"docs">
} & { render(): Render[".mdx"] };
};

};

type DataEntryMap = {

};

type AnyEntryMap = ContentEntryMap & DataEntryMap;

export type ContentConfig = typeof import("../src/content/config.js");
}
43 changes: 43 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import starlight from "@astrojs/starlight";
import { defineConfig } from "astro/config";
import starlightTypeDoc, { typeDocSidebarGroup } from "starlight-typedoc";

// https://astro.build/config
export default defineConfig({
srcDir: "./docs/src",
site: "https://charlesLoder.github.io",
base: process.env.NODE_ENV === "production" ? "/hebrew-transliteration/" : "",
redirects: {
"/": {
status: 302,
destination: "/getting-started/quick-start"
}
},
integrations: [
starlight({
title: `hebrew-transliteration v${process.env.npm_package_version || ""}`,
plugins: [
starlightTypeDoc({
entryPoints: ["./src/index.ts"],
tsconfig: "./.config/tsconfig.json",
typeDoc: {
expandObjects: true,
parametersFormat: "table",
anchorPrefix: "/hebrew-transliteration"
}
})
],
social: {
github: "https://github.com/charlesLoder/hebrew-transliteration"
},
sidebar: [
{
label: "Getting started",
autogenerate: { directory: "getting-started" }
},
// Add the generated sidebar group to the sidebar.
typeDocSidebarGroup
]
})
]
});
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="astro/client" />
6 changes: 6 additions & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineCollection } from "astro:content";
import { docsSchema } from "@astrojs/starlight/schema";

export const collections = {
docs: defineCollection({ schema: docsSchema() })
};
62 changes: 62 additions & 0 deletions src/content/docs/getting-started/quick-start.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Quickstart
---

import { Code, TabItem, Tabs } from "@astrojs/starlight/components";

Create customized Hebrew transliterations.

## Installation

<Tabs syncKey="runtime">
<TabItem label="node" icon="node">
<Code code={"npm i hebrew-transliteration"} lang="bash" frame="code" />
</TabItem>
<TabItem label="deno" icon="deno">
<Code code={`import { transliterate } from "npm:hebrew-transliteration";`} lang="ts" frame="code" />
</TabItem>
<TabItem label="browser" icon="laptop">
<Code code={`import { transliterate } from "https://esm.sh/hebrew-transliteration";`} lang="js" frame="code" />
</TabItem>
</Tabs>

## Usage

<Tabs syncKey="runtime">
<TabItem label="ESM" icon="seti:javascript">
<Code
code={`import { transliterate } from "hebrew-transliteration";\nconst str = "בְּרֵאשִׁ֖ית";\nconsole.log(transliterate(str));\n// bǝrēʾšît;`}
lang="js"
frame="code"
/>
</TabItem>
<TabItem label="CommonJS" icon="node">
<Code
code={`const heb = require("hebrew-transliteration");\nconst str = "בְּרֵאשִׁ֖ית";\nconsole.log(heb.transliterate(str));\n// bǝrēʾšît;`}
lang="js"
frame="code"
/>
</TabItem>
<TabItem label="deno" icon="deno">
<Code
code={`import { transliterate } from "npm:hebrew-transliteration";\nconst str = "בְּרֵאשִׁ֖ית";\nconsole.log(transliterate(str));\n// bǝrēʾšît;`}
lang="ts"
frame="code"
/>
</TabItem>
<TabItem label="browser" icon="laptop">
<Code
code={`import { transliterate } from "https://esm.sh/hebrew-transliteration";\nconst str = "בְּרֵאשִׁ֖ית";\nconsole.log(transliterate(str));\n// bǝrēʾšît;`}
lang="ts"
frame="code"
/>
</TabItem>
</Tabs>

## Key features

This package contains 3 functions for:

- transliteration — [`transliterate()`](/api/functions/transliterate)
- removing niqqud — [`remove()`](/api/functions/remove)
- sequencings text — [`sequence()`](/api/functions/sequence)
3 changes: 3 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference path="../../.astro/types.d.ts" />
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

0 comments on commit d327e81

Please sign in to comment.