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

Styles like Notion dont works #4

Open
Nahuelluca20 opened this issue Oct 7, 2023 · 5 comments
Open

Styles like Notion dont works #4

Nahuelluca20 opened this issue Oct 7, 2023 · 5 comments

Comments

@Nahuelluca20
Copy link

Nahuelluca20 commented Oct 7, 2023

Hello i have a littler problem with de styles. I have this files:

import {NotionRenderer} from "@notion-render/client";
import {notFound} from "next/navigation";
//Plugins
import hljsPlugin from "@notion-render/hljs-plugin";
import bookmarkPlugin from "@notion-render/bookmark-plugin";

import {getPageContent, getPageBySlug, notionClient} from "@/utils/notion";
import Post from "@/components/post";

export default async function page({params}: {params: {slug: string}}) {
  const post = await getPageBySlug(params.slug);

  //Redirect to not found page!
  if (!post) notFound();

  const content = await getPageContent(post.id);

  const notionRenderer = new NotionRenderer({
    client: notionClient,
  });

  notionRenderer.use(hljsPlugin({}));
  notionRenderer.use(bookmarkPlugin(undefined));
  const html = await notionRenderer.render(...content);

  return (
    <Post
      bannerImage={(post.properties.BannerImage as any).url}
      content={html}
      title={(post.properties.Title as any).title[0].plain_text}
    />
  );
}

But the styles like notion dont work

@tiger-githubb
Copy link

I have the same problem

@Nahuelluca20
Copy link
Author

Nahuelluca20 commented Nov 25, 2023

Hey, the problem can be solved with highlight.js. I put this line in the global.css file: @import "highlight.js/styles/monokai.css";

It doesn't solve the problem entirely but it's something.

@phips28
Copy link

phips28 commented Dec 30, 2023

this worked for me:

@import 'node_modules/@notion-render/client/dist/theme.css';

and add the class here:

<div className="notion-render" dangerouslySetInnerHTML={{ __html: html }}></div>

@alahji7
Copy link

alahji7 commented Sep 26, 2024

The styles still don't work. In the tutorial, it says: @import '@notion-render/client/index.css'; but this module can't be found. Does anyone have a solution for this?

@Nahuelluca20
Copy link
Author

Try with use a tailwindcss-typography and highlight.js

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

4 participants