Skip to content

feat: Server side rendering #501

@AKRking

Description

@AKRking

Describe the feature you'd like to request

To render server side I am using a simple instance, but novel extensions not working
import {Mathematics} from "novel/extensions";
throws Mathematics.configure is not a function error


// SimpleEditor.tsx
import React from 'react';
import { generateHTML } from '@tiptap/html';
import { type JSONContent } from '@tiptap/react';
import { simpleextensions } from './simple-extensions';

import 'katex/dist/katex.min.css';

// Define proper type for jsonContent
interface SimpleEditorProps {
  jsonContent: JSONContent;
}

const SimpleEditor = ({ jsonContent }: SimpleEditorProps) => {
  // Using the pre-configured extensions from extensions.ts
  const html = generateHTML(jsonContent, simpleextensions);

  return (
    <div 
      className="novel-content-container" 
      dangerouslySetInnerHTML={{ __html: html }}
    />
  );
};

export default SimpleEditor;

in my simple extension file

//simple-extensions.ts
import StarterKit from '@tiptap/starter-kit'


import Youtube from '@tiptap/extension-youtube'
import {Mathematics} from "novel/extensions"; 
import { cx } from 'class-variance-authority'


const mathematics = Mathematics.configure({ 
    HTMLAttributes: {
      class: cx("text-foreground rounded p-1 hover:bg-accent cursor-pointer"), 
    },
    katexOptions: {
      throwOnError: false, 
    },
  });

export const simpleextensions = [
    StarterKit, 
    Youtube,
    mathematics 
  ];

And i see a new extension called @tiptap/static-renderer, is this useful,can it work with novel?

Describe the solution you'd like to see

Render novel jsoncontent on server side,
My four months of ambition have come to a standstill here. Any direction will be appreciated

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions