Use Org mode files in Next.js with Orgajs.
This repository is a pnpm workspace.
- Root package:
@orgajs/next - Example app:
example
pnpm add @orgajs/next @orgajs/loader @orgajs/reactYou can also use npm or yarn.
Create a next.config.js in your project:
const withOrg = require('@orgajs/next')()
module.exports = withOrg({
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'org'],
})By default, @orgajs/next matches and compiles files with the .org extension.
You can pass Org loader options:
const withOrg = require('@orgajs/next')({
options: {
jsxRuntime: 'automatic',
},
})
module.exports = withOrg()Create an org-components.js file at your project root to provide global Org components:
export function useOrgComponents() {
return {
h1: (props) => <h1 style={{ color: 'tomato' }} {...props} />,
}
}Install workspace dependencies from the repository root:
pnpm installRun the example app:
pnpm --filter orga-next-example devMIT