Color mode

Search notes

Filter with tag:, lang:, or path:.

フックコンテキスト(Hook Context)

フックに渡されるプラグインのコンテキストにはconfig、contentIndex、diagnostics、cache、output、logger、tracerが含まれ、任意でcontentSourceも渡されます。グローバルなシングルトンより、フレームワークのサービスを優先してください。

PluginContextの形

ts
type PluginContext = {
  config?: ResolvedRiebeckiteConfig;
  contentIndex: Map<string, string>;
  diagnostics: Diagnostic[];
  cache: PluginCache;
  output: GeneratedOutputSink;
  logger: Logger;
  tracer: Tracer;
  contentSource?: ContentSource;
};

フックごとの追加

フックによってはslug、markdown、content、manifest、entries、公開先の入力などのフィールドが追加されます。フックごとの追加は次の表のとおりです。

フック 追加フィールド
onConfigResolved config
onContentLoaded slug、content
onPostParsed markdown、slug
onPostProcessed markdown、slug、content
onManifestCreated manifest、entries

グローバルなシングルトンを作るより、常にコンテキストからフレームワークのサービスを受け取ってください。

関連用語

さらに詳しく

Local Graph

Nearby Notes

Open in Explorer →
フックコンテキスト(Hook Context)プラグイン(Plugin)コンテンツフック(Content Hook)ライフサイクルフック(Lifecycle hook)診断(Diagnostics)
CurrentOutgoingBacklink