Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins don't work #3

Open
cailynyongyong opened this issue Oct 1, 2023 · 1 comment
Open

Plugins don't work #3

cailynyongyong opened this issue Oct 1, 2023 · 1 comment

Comments

@cailynyongyong
Copy link

cailynyongyong commented Oct 1, 2023

The plugins for bookmark and hljs don't work.

For example, this is the code I'm running.

import { notFound } from "next/navigation";
import bookmark from "@notion-render/bookmark-plugin";
import { NotionRenderer } from "@notion-render/client";
import hljsPlugin from "@notion-render/hljs-plugin";
import { Client } from "@notionhq/client"
import { fetchPageBlocks, fetchPageBySlug } from "@/lib/notion";

export default async function Page({ params }: { params: { slug: string } }) {
  const post = await fetchPageBySlug("week1")
  if (!post) notFound()

  const blocks = await fetchPageBlocks(post.id)
  const client = new Client({ auth: process.env.NOTION_TOKEN })
  const renderer = new NotionRenderer({ client })

  const html = await renderer.render(...blocks)

  renderer.use(hljsPlugin())
  renderer.use(bookmark())

  return (
    <div
      dangerouslySetInnerHTML={{ __html: html }}
    ></div>
  )
}

The plugin codes return an error saying that "Expected 1 arguments, but got 0.ts(2554)
plugin.d.ts(2, 41): An argument for 'config' was not provided."

@cailynyongyong cailynyongyong changed the title Renderer doesn't work for headings, bullet list, code block, inline code Plugins don't work Oct 1, 2023
@phips28
Copy link

phips28 commented Dec 30, 2023

its just typescript, use:

  renderer.use(hljsPlugin({}))
  renderer.use(bookmarkPlugin(undefined))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants