API Reference
Org-press exposes several APIs for different use cases.
APIs
- Modes API - Unified composable block rendering system
- Plugin API - Create custom block plugins
- JavaScript API - Programmatic usage
- HMR API - Hot module replacement
- CLI Plugins - Extend the CLI
Quick Links
For Block Rendering
#+begin_src javascript :use dom | withSourceCode
// Execute code and show both source and result
console.log("Hello World");
#+end_src
#+begin_src javascript :use sourceOnly
// Display code without execution
const x = 1;
#+end_src
See Modes API.
For Plugin Authors
import type { BlockPlugin } from "org-press";
export const myPlugin: BlockPlugin = {
name: "my-plugin",
// ...
};
See Plugin API.
For Programmatic Usage
import { parseOrgContent, renderOrg } from "org-press";
const parsed = await parseOrgContent(content, context);
const result = await renderOrg(parsed.ast, renderContext);
See JavaScript API.
For CLI Extensions
export const myPlugin: BlockPlugin = {
name: "my-plugin",
cli: {
command: "mycommand",
description: "Do something",
action: async (args, config) => {
// ...
},
},
};
See CLI Plugins.