এক নজরে Types

import type { function sveltekit(config?: KitConfig & Omit<Options, "onwarn"> & Pick<SvelteConfig, "vitePlugin">): Promise<Plugin[]>

Returns the SvelteKit Vite plugins. Since version 2.62.0 you can pass configuration directly, in which case svelte.config.js is ignored. Any options that don't belong to SvelteKit are passed through to vite-plugin-svelte.

sveltekit
} from '@sveltejs/kit/vite'
import type { import BundledLanguageBundledLanguage } from 'shiki/langs' import type { import PluginPlugin } from 'unified' import type {
type PluginOption = Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[] | Promise<Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[]>
PluginOption
} from 'vite'
/** * The options accepted by SvelteKit's `sveltekit()` vite plugin. * * On the newer SvelteKit project layout there is no `svelte.config.js` and all * config (`compilerOptions`, `adapter`, ...) is passed inline to `sveltekit()` * in `vite.config.ts`. Forward those options through `sveltepress()` so the * standalone `sveltekit()` plugin can be removed (having both crashes the dev * server with duplicated Svelte compilation). */ export type type SvelteKitOptions = (KitConfig & Omit<Options, "onwarn"> & Pick<SvelteConfig, "vitePlugin">) | undefined

The options accepted by SvelteKit's sveltekit() vite plugin.

On the newer SvelteKit project layout there is no svelte.config.js and all config (compilerOptions, adapter, ...) is passed inline to sveltekit() in vite.config.ts. Forward those options through sveltepress() so the standalone sveltekit() plugin can be removed (having both crashes the dev server with duplicated Svelte compilation).

SvelteKitOptions
= type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never

Obtain the parameters of a function type in a tuple

Parameters
<typeof function sveltekit(config?: KitConfig & Omit<Options, "onwarn"> & Pick<SvelteConfig, "vitePlugin">): Promise<Plugin[]>

Returns the SvelteKit Vite plugins. Since version 2.62.0 you can pass configuration directly, in which case svelte.config.js is ignored. Any options that don't belong to SvelteKit are passed through to vite-plugin-svelte.

sveltekit
>[0]
export type type RemarkLiveCode = Plugin<[], any>RemarkLiveCode = import PluginPlugin<[], any> export type type Highlighter = (code: string, lang: BundledLanguage, meta?: string) => string | Promise<string>Highlighter = (code: stringcode: string, lang: BundledLanguagelang: import BundledLanguageBundledLanguage, meta: string | undefinedmeta?: string) => string | interface Promise<T>

Represents the completion of an asynchronous operation

Promise
<string>
export type type ThemeVitePlugins = PluginOption[] | ((corePlugin: PluginOption) => Promise<PluginOption[]>) | ((corePlugin: PluginOption) => PluginOption[])ThemeVitePlugins =
type PluginOption = Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[] | Promise<Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[]>
PluginOption
[] | ((corePlugin: PluginOptioncorePlugin:
type PluginOption = Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[] | Promise<Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[]>
PluginOption
) => interface Promise<T>

Represents the completion of an asynchronous operation

Promise
<
type PluginOption = Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[] | Promise<Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[]>
PluginOption
[]>) | ((corePlugin: PluginOptioncorePlugin:
type PluginOption = Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[] | Promise<Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[]>
PluginOption
) =>
type PluginOption = Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[] | Promise<Plugin<any> | {
    name: string;
} | FalsyPlugin | PluginOption[]>
PluginOption
[])
export interface SiteConfig { SiteConfig.title?: string | undefinedtitle?: string SiteConfig.description?: string | undefineddescription?: string } export interface ResolvedTheme { ResolvedTheme.name: stringname: string ResolvedTheme.globalLayout: stringglobalLayout: string ResolvedTheme.pageLayout: stringpageLayout: string ResolvedTheme.vitePlugins: ThemeVitePluginsvitePlugins: type ThemeVitePlugins = PluginOption[] | ((corePlugin: PluginOption) => Promise<PluginOption[]>) | ((corePlugin: PluginOption) => PluginOption[])ThemeVitePlugins ResolvedTheme.highlighter: Highlighterhighlighter: type Highlighter = (code: string, lang: BundledLanguage, meta?: string) => string | Promise<string>Highlighter ResolvedTheme.remarkPlugins?: Plugin[] | undefinedremarkPlugins?: import PluginPlugin[] ResolvedTheme.rehypePlugins?: Plugin[] | undefinedrehypePlugins?: import PluginPlugin[] /** * The footnote label used for [remark rehype](https://github.com/remarkjs/remark-rehype#api) */ ResolvedTheme.footnoteLabel?: string | undefined

The footnote label used for remark rehype

footnoteLabel
?: string
/** Receive the core version configuration before theme plugins are resolved. */ ResolvedTheme.configureVersions?: ((versions: VersionPluginOptions) => void) | undefined

Receive the core version configuration before theme plugins are resolved.

configureVersions
?: (
versions: false | {
    manifest?: string;
} | undefined
versions
:
type VersionPluginOptions = false | {
    manifest?: string;
} | undefined
VersionPluginOptions
) => void
} export type
type VersionPluginOptions = false | {
    manifest?: string;
} | undefined
VersionPluginOptions
= SveltepressVitePluginOptions['versions']
export type type RemarkPluginsOrderer = (themeRemarkPlugins: Plugin[]) => Plugin[]RemarkPluginsOrderer = ((themeRemarkPlugins: Plugin[]themeRemarkPlugins: import PluginPlugin[]) => import PluginPlugin[]) export type type RehypePluginsOrderer = (themeRehypePlugins: Plugin[]) => Plugin[]RehypePluginsOrderer = ((themeRehypePlugins: Plugin[]themeRehypePlugins: import PluginPlugin[]) => import PluginPlugin[]) export interface PageInfo { PageInfo.title: stringtitle: string PageInfo.routePath: stringroutePath: string PageInfo.content: stringcontent: string PageInfo.frontmatter: Record<string, unknown>frontmatter: type Record<K extends keyof any, T> = { [P in K]: T; }

Construct a type with a set of properties K of type T

Record
<string, unknown>
} /** * A single locale of a multi-locale site. Keyed by its URL prefix (`'/'` for * the default locale, `'/zh/'`, `'/bn/'`, ...). */ export interface interface LocaleConfig<ThemeOptions = any>

A single locale of a multi-locale site. Keyed by its URL prefix ('/' for the default locale, '/zh/', '/bn/', ...).

LocaleConfig
<function (type parameter) ThemeOptions in LocaleConfig<ThemeOptions = any>ThemeOptions = any> {
/** BCP 47 language tag, e.g. `'en'`, `'zh-CN'`, `'bn'`. */ LocaleConfig<ThemeOptions = any>.lang: string

BCP 47 language tag, e.g. 'en', 'zh-CN', 'bn'.

lang
: string
/** User-facing label rendered in the language switcher. */ LocaleConfig<ThemeOptions = any>.label: string

User-facing label rendered in the language switcher.

label
: string
/** The locale's full theme options. */ LocaleConfig<ThemeOptions = any>.theme: ThemeOptions = any

The locale's full theme options.

theme
: function (type parameter) ThemeOptions in LocaleConfig<ThemeOptions = any>ThemeOptions
/** * Logical routes available in this locale (no locale prefix). Populated by * the core plugin from the routes directory; only needed explicitly when * constructing configs directly. */ LocaleConfig<ThemeOptions = any>.routes?: string[] | undefined

Logical routes available in this locale (no locale prefix). Populated by the core plugin from the routes directory; only needed explicitly when constructing configs directly.

routes
?: string[]
} /** Multi-locale site configuration keyed by URL prefix. */ export type
type LocalesConfig<ThemeOptions = any> = {
    [x: string]: LocaleConfig<ThemeOptions>;
}

Multi-locale site configuration keyed by URL prefix.

LocalesConfig
<function (type parameter) ThemeOptions in type LocalesConfig<ThemeOptions = any>ThemeOptions = any> = type Record<K extends keyof any, T> = { [P in K]: T; }

Construct a type with a set of properties K of type T

Record
<string, interface LocaleConfig<ThemeOptions = any>

A single locale of a multi-locale site. Keyed by its URL prefix ('/' for the default locale, '/zh/', '/bn/', ...).

LocaleConfig
<function (type parameter) ThemeOptions in type LocalesConfig<ThemeOptions = any>ThemeOptions>>
/** A locale resolved from a route: the locale config plus its matched prefix. */ export interface interface ResolvedLocale<ThemeOptions = any>

A locale resolved from a route: the locale config plus its matched prefix.

ResolvedLocale
<function (type parameter) ThemeOptions in ResolvedLocale<ThemeOptions = any>ThemeOptions = any> extends interface LocaleConfig<ThemeOptions = any>

A single locale of a multi-locale site. Keyed by its URL prefix ('/' for the default locale, '/zh/', '/bn/', ...).

LocaleConfig
<function (type parameter) ThemeOptions in ResolvedLocale<ThemeOptions = any>ThemeOptions> {
/** The locale's URL prefix, e.g. `'/'`, `'/zh/'`. */ ResolvedLocale<ThemeOptions = any>.prefix: string

The locale's URL prefix, e.g. '/', '/zh/'.

prefix
: string
} /** The target of a locale switch. */ export interface LocaleSwitchTarget { LocaleSwitchTarget.href: stringhref: string /** Whether the target locale lacks the logical page and the href falls back to its home. */ LocaleSwitchTarget.fallback: boolean

Whether the target locale lacks the logical page and the href falls back to its home.

fallback
: boolean
} /** * Slim per-locale version snapshot used by the language switcher. Only the * fields needed to keep the same frozen version (and fall back otherwise) * are required; full manifests stay on `virtual:sveltepress/versions`. */ export interface LocaleVersionSnapshot { LocaleVersionSnapshot.basePath: stringbasePath: string
LocaleVersionSnapshot.current: {
    id: string;
    routes?: string[];
}
current
: { id: stringid: string, routes?: string[] | undefinedroutes?: string[] }
LocaleVersionSnapshot.versions: {
    id: string;
    routes?: string[];
}[]
versions
: interface Array<T>Array<{ id: stringid: string, routes?: string[] | undefinedroutes?: string[] }>
} export interface LlmsConfig { LlmsConfig.enabled?: boolean | undefinedenabled?: boolean LlmsConfig.title?: string | undefinedtitle?: string LlmsConfig.description?: string | undefineddescription?: string LlmsConfig.baseUrl?: string | undefinedbaseUrl?: string LlmsConfig.routesDir?: string | undefinedroutesDir?: string LlmsConfig.filter?: ((filePath: string, frontmatter: Record<string, unknown>) => boolean) | undefinedfilter?: (filePath: stringfilePath: string, frontmatter: Record<string, unknown>frontmatter: type Record<K extends keyof any, T> = { [P in K]: T; }

Construct a type with a set of properties K of type T

Record
<string, unknown>) => boolean
LlmsConfig.sort?: ((a: PageInfo, b: PageInfo) => number) | undefinedsort?: (a: PageInfoa: PageInfo, b: PageInfob: PageInfo) => number } export interface SveltepressVitePluginOptions { SveltepressVitePluginOptions.theme?: ResolvedTheme | undefinedtheme?: ResolvedTheme SveltepressVitePluginOptions.siteConfig?: SiteConfig | undefinedsiteConfig?: SiteConfig SveltepressVitePluginOptions.addInspect?: boolean | undefinedaddInspect?: boolean SveltepressVitePluginOptions.remarkPlugins?: Plugin[] | RemarkPluginsOrderer | undefinedremarkPlugins?: import PluginPlugin[] | type RemarkPluginsOrderer = (themeRemarkPlugins: Plugin[]) => Plugin[]RemarkPluginsOrderer SveltepressVitePluginOptions.rehypePlugins?: Plugin[] | RehypePluginsOrderer | undefinedrehypePlugins?: import PluginPlugin[] | type RehypePluginsOrderer = (themeRehypePlugins: Plugin[]) => Plugin[]RehypePluginsOrderer SveltepressVitePluginOptions.llms?: LlmsConfig | undefinedllms?: LlmsConfig /** * Multi-locale site configuration keyed by URL prefix (`'/'` for the default * locale, `'/zh/'`, `'/bn/'`, ...). Each entry carries that locale's `lang`, * a user-facing `label` for the switcher, and its full theme options. * * When omitted the site stays single-locale and behavior is unchanged. */ SveltepressVitePluginOptions.locales?: LocalesConfig<any> | undefined

Multi-locale site configuration keyed by URL prefix ('/' for the default locale, '/zh/', '/bn/', ...). Each entry carries that locale's lang, a user-facing label for the switcher, and its full theme options.

When omitted the site stays single-locale and behavior is unchanged.

locales
?:
type LocalesConfig<ThemeOptions = any> = {
    [x: string]: LocaleConfig<ThemeOptions>;
}

Multi-locale site configuration keyed by URL prefix.

LocalesConfig
/** * Enable document version management by discovering * `sveltepress.versions.json`, override its location, or disable discovery. */
SveltepressVitePluginOptions.versions?: false | {
    manifest?: string;
} | undefined

Enable document version management by discovering sveltepress.versions.json, override its location, or disable discovery.

versions
?: false | {
manifest?: string | undefinedmanifest?: string } /** * Options forwarded to the SvelteKit vite plugin that `sveltepress()` sets up * internally. * * Use this on the newer SvelteKit layout (no `svelte.config.js`, config passed * inline to `sveltekit()\SveltepressVitePluginOptions.svelteKitOptions?: (KitConfig & Omit<Options, "onwarn"> & Pick<SvelteConfig, "vitePlugin">) | undefined

Options forwarded to the SvelteKit vite plugin that sveltepress() sets up internally.

Use this on the newer SvelteKit layout (no svelte.config.js, config passed inline to sveltekit()) to move your compilerOptions, adapter, etc. into sveltepress() and remove the standalone sveltekit() plugin. '.md' is always added to extensions automatically.

When omitted, SvelteKit reads its config from svelte.config.js as before.

svelteKitOptions
?: type SvelteKitOptions = (KitConfig & Omit<Options, "onwarn"> & Pick<SvelteConfig, "vitePlugin">) | undefined

The options accepted by SvelteKit's sveltekit() vite plugin.

On the newer SvelteKit project layout there is no svelte.config.js and all config (compilerOptions, adapter, ...) is passed inline to sveltekit() in vite.config.ts. Forward those options through sveltepress() so the standalone sveltekit() plugin can be removed (having both crashes the dev server with duplicated Svelte compilation).

SvelteKitOptions
/** * Options for Pagefind static local search indexing. * Set to `false` to disable automatic post-build indexing. */ SveltepressVitePluginOptions.pagefind?: any

Options for Pagefind static local search indexing. Set to false to disable automatic post-build indexing.

pagefind
?: boolean | import('./pagefind.js').PagefindOptions
} export type type LoadTheme<ThemeOptions = any> = (themeOptions?: ThemeOptions) => ResolvedThemeLoadTheme<function (type parameter) ThemeOptions in type LoadTheme<ThemeOptions = any>ThemeOptions = any> = (themeOptions: ThemeOptions | undefinedthemeOptions?: function (type parameter) ThemeOptions in type LoadTheme<ThemeOptions = any>ThemeOptions) => ResolvedTheme export type type RawRemarkPlugin = anyRawRemarkPlugin = import PluginPlugin<any[], any> | [import PluginPlugin<any[], any>, any] export type type AcceptableRemarkPlugin = any[]AcceptableRemarkPlugin = interface Array<T>Array<type RawRemarkPlugin = anyRawRemarkPlugin>
ts
Expand code

প্লাগিন অপশন

siteConfig

  • title: সাইটের টাইটেল। না থাকলে 'Untitled site' দেখাবে।
  • description: সাইটের ডেসক্রিপশন। না থাকলে 'Build by sveltepress' দেখাবে।

addInspect

যদি true সেট করা হয়, তাহলে Vite plugin inspect যোগ করা হবে। ভিট পাইপলাইন দেখা ও পর্যবেক্ষণ করা বেশ উপকারী।

theme

নিম্নে ResolvedTheme দেখুন

remarkPlugins

The remark plugins ব্যবহার করা হয়েছে মার্কডাউন এর জন্য। আরো জানতে Remark plugins পড়ুন।

rehypePlugins

The rehype plugins ব্যবহার করা হয়েছে html জেনারেট করার জন্য। আরো জানতে Rehype plugins পড়ুন।

llms

production build-এর সময় machine-readable documentation index তৈরি করে। ডিফল্টে বন্ধ থাকে।

vite.config.ts
import { const sveltepress: (options?: SveltepressVitePluginOptions) => PluginOptionsveltepress } from '@sveltepress/vite'

function sveltepress(options?: SveltepressVitePluginOptions): PluginOptionsveltepress({
  SveltepressVitePluginOptions.siteConfig?: SiteConfig | undefinedsiteConfig: {
    SiteConfig.title?: string | undefinedtitle: 'My docs',
    SiteConfig.description?: string | undefineddescription: 'Documentation for my project',
  },
  SveltepressVitePluginOptions.llms?: LlmsConfig | undefinedllms: {
    LlmsConfig.enabled?: boolean | undefinedenabled: true,
    LlmsConfig.baseUrl?: string | undefinedbaseUrl: 'https://docs.example.com',
    LlmsConfig.filter?: ((filePath: string, frontmatter: Record<string, unknown>) => boolean) | undefinedfilter: (_filePath: string_filePath, frontmatter: Record<string, unknown>frontmatter) => frontmatter: Record<string, unknown>frontmatter.unknownllms !== false,
  },
})
ts
OptionTypeDefaultকাজ
enabledbooleanfalsebuild-এর সময় llms.txtllms-full.txt লেখে।
titlestringsiteConfig.titleতৈরি হওয়া উভয় ফাইলের title।
descriptionstringsiteConfig.descriptionতৈরি হওয়া উভয় ফাইলের description।
baseUrlstring''route link-এর আগে যোগ হওয়া absolute site origin।
routesDirstring'src/routes'page scan করার directory।
filter(filePath, frontmatter) => booleanনির্বাচিত page বাদ দেয়।
sort(a, b) => numberroute pathpage order কাস্টমাইজ করে।

Generator শুধু Markdown page পড়ে; Svelte-only page ও runtime data অন্তর্ভুক্ত হয় না। Incremental document version চালু থাকলে historical index বর্তমান source-এর বদলে প্রতিটি page-এর frozen Markdown artifact পড়ে। Build ফাইলগুলো static/ ও production bundle—দুই জায়গাতেই লেখে, তাই clean CI build-এর deployed output-এও সেগুলো থাকে। static/ copy commit করবেন নাকি ignore করে CI-তে regenerate করবেন তা স্থির রাখুন।

Version change discovery

versions

Document version management-কে sveltepress.versions.json থেকে স্বয়ংক্রিয়ভাবে আবিষ্কার করা হয়। Discovery বন্ধ করুন বা অন্য manifest path চয়ন করুন:

import { const sveltepress: (options?: SveltepressVitePluginOptions) => PluginOptionsveltepress } from '@sveltepress/vite'

function sveltepress(options?: SveltepressVitePluginOptions): PluginOptionsveltepress({
  
SveltepressVitePluginOptions.versions?: false | {
    manifest?: string;
} | undefined

Enable document version management by discovering sveltepress.versions.json, override its location, or disable discovery.

versions
: false,
}) function sveltepress(options?: SveltepressVitePluginOptions): PluginOptionsveltepress({
SveltepressVitePluginOptions.versions?: false | {
    manifest?: string;
} | undefined

Enable document version management by discovering sveltepress.versions.json, override its location, or disable discovery.

versions
: { manifest?: string | undefinedmanifest: 'config/document-versions.json' },
})
ts

সক্রিয় হলে virtual:sveltepress/versions manifest ও route helper-এর পাশাপাশি changeSetsresolveVersionChanges(versionId?) export করে। Snapshot ও What’s New ব্যবহারের জন্যডকুমেন্ট সংস্করণ ব্যবস্থাপনা দেখুন।

Locales, Pagefind, and locale hooks

locales

Opt-in multi-locale map keyed by URL prefix. See আন্তর্জাতিকীকরণ.

pagefind

Post-build Pagefind indexing for Local Search. Set false to disable. Historical indexes freeze via syncHistoricalPagefind.

virtual:sveltepress/locale

Exports locales, resolveLocale, resolveLocalizedPath, resolveLocaleSwitch when locales are configured.

createLocaleHandle

From /vite/hooks — sets SSR <html lang>. See the i18n guide.

ResolvedTheme

name

থিমের নাম

globalLayout

গ্লোবাল লে আউটের অ্যাবসোলুট পাথ। svelte ফাইল হতে হবে যেমন: path.resolve(process.cwd(), 'ThemeGlobalLayout.svelte')

pageLayout

পেজ লে আউটের অ্যাবসোলুট পাথ svelte ফাইল হতে হবে যেমন: path.resolve(process.cwd(), 'ThemePageLayout.svelte')

vitePlugins

  • যদি এক বা একাধিক প্লাগিন পাস করা হয়, সেই প্লাগিনগুলো sveltepress এর সামনে অ্যাপ্লাই করা হবে।
  • যদি একটি ফাংশন পাস করা হয়, এটি sveltepress অ্যাক্সেপ্ট করবে এবং প্লাগিনের গ্রুপ রিটার্ন করবে। আপনি রিটার্নকৃত প্লাগিন চেইনে sveltepress এর প্লাগিন অর্ডার কাস্টমাইজ করতে পারেন।
থিম ভিট প্লাগিন সম্পর্কে

এটি হয়ত একটু অদ্ভুত যে থিমের ভিট প্লাগিন আছে। কিন্তু এটি উপকারী যখন থিম কিছু ভার্চুয়াল মডিউল যুক্ত করতে চায় অথবা কিছু টেম্প ফাইল তৈরি করতে চায়।

highlighter

কোড হাইলাইটিং এর জন্য ব্যবহৃত। যেমন, ডিফল্ট থিম shiki ব্যবহার করে। বিস্তারিত ব্যবহারের জন্য ডিফল্ট থিম হাইলাইটার সোর্স কোড দেখুন।

remarkPlugins

The remark plugins ব্যবহৃত হয় মার্কডাউন পার্সিং এর জন্য। বিস্তারিত জানতে Remark plugins পড়ুন।

rehypePlugins

html জেনারেটরের জন্য The rehype plugins ব্যবহৃত হয়। বিস্তারিত জানতে Rehype plugins পড়ুন।

প্লাগিনের ধারাবাহিকতা

থিম কর্তৃক প্রোভাইডকৃত The remark এবং rehype plugins তা ভিট প্লাগিনের প্রোভাইডকৃত প্লাগিনের পূর্বে কল করা হবে। উদাহরণস্বরূপ:

vite.config.(js|ts)
import { const defaultTheme: ThemeDefaultdefaultTheme } from '@sveltepress/theme-default'
import { const sveltepress: (options?: SveltepressVitePluginOptions) => PluginOptionsveltepress } from '@sveltepress/vite'
import { function defineConfig(config: UserConfig): UserConfig (+5 overloads)

Type helper to make it easier to use vite.config.ts accepts a direct

UserConfig

object, or a function that returns it. The function receives a

ConfigEnv

object.

defineConfig
} from 'vite'
export default function defineConfig(config: UserConfig): UserConfig (+5 overloads)

Type helper to make it easier to use vite.config.ts accepts a direct

UserConfig

object, or a function that returns it. The function receives a

ConfigEnv

object.

defineConfig
({
UserConfig.plugins?: PluginOption[] | undefined

Array of vite plugins to use.

plugins
: [
function sveltepress(options?: SveltepressVitePluginOptions): PluginOptionsveltepress({ SveltepressVitePluginOptions.theme?: ResolvedTheme | undefinedtheme: function defaultTheme(themeOptions?: DefaultThemeOptions | undefined): ResolvedThemedefaultTheme(/* theme options */), SveltepressVitePluginOptions.remarkPlugins?: Plugin[] | RemarkPluginsOrderer | undefinedremarkPlugins: [/* yourRemarkPlugin */] }) ] })
ts

yourRemarkPlugin রান হবে ডিফল্ট থিমের remark plugins এর পরে।

footnoteLabel

ফুটনোটের টাইটেল কাস্টমাইজ করতে। ডিফল্ট হচ্ছে "Footnotes"

Virtual modules

virtual:sveltepress/site

এই মডিউল siteConfig কে হোল্ড করে। এখানে একটি উদাহরণ-

<script>
  import 
const siteConfig: {
    title: string;
    description: string;
}
siteConfig
from 'virtual:sveltepress/site'
</script> <p>The site title is: {
const siteConfig: {
    title: string;
    description: string;
}
siteConfig
.title: stringtitle}</p>
<p>The site description is: {
const siteConfig: {
    title: string;
    description: string;
}
siteConfig
.description: stringdescription}</p>
svelte

Low level API

The @sveltepress/vite এর mdToSvelte একটি লোড লেভেল এপিআই ফাংশন আছে এটি Sveltepress এ সকল বড় বড় মার্কডাউন রেন্ডারের জন্য ব্যবহৃত হয়। এটি Svelte এর সাথে সম্পৃক্ত আরো বেসিক মার্কডাউন রেন্ডারিং ইঞ্জিনের জন্য ব্যবহার করা যাবে ।

ব্যবহারবিধি:

import { 
function mdToSvelte({ mdContent, remarkPlugins, rehypePlugins, highlighter, filename, footnoteLabel, data: inputData, }: CompileOptions): Promise<{
    data: Record<string, any>;
    code: string;
}>
mdToSvelte
} from '@sveltepress/vite'
const const mdContent: "\ ---\ title: Foo\ ---\ <script>\ const foo = 'bar'\ </script>\ # Title\ \ foo in script is: {foo}\ \ [Foo Link](https://foo.bar)\ "mdContent = ` --- title: Foo --- <script> const foo = 'bar' </script> # Title foo in script is: {foo} [Foo Link](https://foo.bar) ` const { const code: stringcode, const data: Record<string, any>data } = await
function mdToSvelte({ mdContent, remarkPlugins, rehypePlugins, highlighter, filename, footnoteLabel, data: inputData, }: CompileOptions): Promise<{
    data: Record<string, any>;
    code: string;
}>
mdToSvelte
({
CompileOptions.mdContent: stringmdContent, CompileOptions.remarkPlugins?: (Plugin<any[], any> | [Plugin<any[], any>, any])[] | undefinedremarkPlugins: [], // your custom remark plugins CompileOptions.rehypePlugins?: Plugin[] | undefinedrehypePlugins: [], // your custom rehype plugins CompileOptions.highlighter?: Highlighter | undefinedhighlighter: async (code: stringcode, lang: BundledLanguagelang, meta: string | undefinedmeta) => var Promise: PromiseConstructor

Represents the completion of an asynchronous operation

Promise
.PromiseConstructor.resolve<string>(value: string): Promise<string> (+2 overloads)

Creates a new resolved promise for the provided value.

@paramvalue A promise.@returnsA promise whose internal state matches the provided promise.
resolve
('The rendered highlighted code html'), // your custom code highlighter
CompileOptions.filename: stringfilename: 'foo.md', // the virtual file path }) // The rendered svelte code const code: stringcode // The frontmatter object, { title: 'Foo' } const data: Record<string, any>data
ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Literal code প্রস্তুতি

@sveltepress/vite/highlight

@sveltepress/vite/highlight থেকে prepareCodeBlock import করে তৃতীয় argument-এ { mode: 'literal' } দিন। এই mode source transform করে না: // [svp! ...] code command এবং প্রথম লাইনের // @noErrors হুবহু processedCode-এ থাকে। তবে metadata parsing চালু থাকে, তাই titleln যথাক্রমে title এবং line-number state নির্ধারণ করে।

import { function prepareCodeBlock(code: string, meta?: string, options?: PrepareCodeBlockOptions): PreparedCodeBlock

Parse code block metadata and process code commands. Call BEFORE Shiki highlighting.

prepareCodeBlock
} from '@sveltepress/vite/highlight'
const const prepared: PreparedCodeBlockprepared = function prepareCodeBlock(code: string, meta?: string, options?: PrepareCodeBlockOptions): PreparedCodeBlock

Parse code block metadata and process code commands. Call BEFORE Shiki highlighting.

prepareCodeBlock
(
'// @noErrors\ const value = 1 ', 'title="source.md" ln', { PrepareCodeBlockOptions.mode?: "commands" | "literal" | undefined

Use literal mode to skip code commands and

@noErrorsprocessing.
mode
: 'literal' },
)
ts

এখানে prepared.processedCode input-এর সমান, prepared.title হলো 'source.md', এবং prepared.containLineNumbers হলো trueprepared.noErrors থাকে false, কারণ literal mode-এ @noErrors সংরক্ষিত হলেও directive হিসেবে process হয় না।

Typescript এর ব্যবহার

প্লাগিন অপশন এবং ভার্চুয়াল মডিউল টাইপ টিপসের জন্য src/app.d.ts তে @sveltepress/vite/types যুক্ত করতে হবে

/src/app.d.ts
/// <reference types="@sveltepress/vite/types" />

// এখানে আপনার অন্যান্য টাইপ থাকবে
ts