Skip to content

Docs: dedicated math, diagram & source-with-preview pages - #2966

Merged
nperez0111 merged 7 commits into
code-block-previewsfrom
docs-restructure
Aug 12, 2026
Merged

Docs: dedicated math, diagram & source-with-preview pages#2966
nperez0111 merged 7 commits into
code-block-previewsfrom
docs-restructure

Conversation

@YousefED

@YousefED YousefED commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #2961 (math-diagram-exporters). Restructures the code-block/math/diagram documentation and establishes the editorial conventions it follows (now in .claude/skills/docs-skill).

The restructure

The old code-blocks.mdx served four different readers on one 400-line page — code blocks, syntax highlighting, math/diagrams (invisible in the sidebar!), and building your own preview blocks. It's now four focused pages:

  • Code Blocks — just code blocks, with syntax highlighting explained simple-first (install @blocknote/code-block, add syntaxHighlighter, done); the extension architecture moved under "Custom Syntax Highlighting".
  • Math & Equations and Diagrams — new sidebar entries: setup, a compact "Menu items & localization" section (full wiring lives in the linked component pages and the example), the live example, and a format-by-format Exporting section with mapping setup and factory option signatures. Each block page owns its own story — e.g. the renderDiagram server-side setup now exists once on the diagram page instead of being duplicated on four export pages.
  • Source with Preview Blocks (under Custom Schemas) — building your own preview blocks, as a three-step walkthrough. The complete implementation lives in a new embedded example (custom-schema/source-with-preview: a CSV table block + a color chip inline content) rather than in page-length snippets — the example is type-checked and rendered, so the documented API can't silently rot. Writing it also caught that this page documented a deleted API (per-spec extension options vs. today's meta.hasPreview).

The export pages keep short stubs linking to the block pages; the email page keeps image delivery (that's email-client knowledge) with the math/diagram section moved below the generic sections.

Conventions established (in the new docs skill)

  • Simple first, architecture later; one page per feature users search for; single-source each mechanism and link to it.
  • Complete implementations are live examples (compiled + rendered, can't rot); page snippets are one-concept walkthrough fragments; copy-paste setup snippets carry their imports.
  • Example embeds cap the setup they demonstrate — everything the example's code uses is introduced (named + linked) before the embed.
  • Caveats must be actionable; signature snippets tell the truth for exactly one API (no "only for subpath X" doc-comments inside a shared signature).
  • The verification loop: snippet symbols checked against real package exports, validate-links (routes and anchors), dev-server render checks, playwright screenshots.

Also fixed

  • docs/validate-links.mjs silently validated zero files when run from anywhere but docs/ (cwd-relative globs + the glob library snapshotting process.cwd() at import time). It now works from any directory — and genuinely validates anchors, which it was already capable of.
  • document-structure.mdx uses plainContentToString instead of hand-joining content items.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added documentation for math blocks, diagram blocks, and custom source-with-preview content.
    • Added a runnable example featuring CSV table previews and color-chip inline content.
    • Added math and diagram pages to built-in block navigation.
  • Documentation

    • Clarified code-block syntax highlighting, configuration, and custom highlighter usage.
    • Simplified export guidance for DOCX, PDF, ODT, email, and Markdown.
    • Improved plain-text content extraction recommendations.
  • Chores

    • Improved link validation consistency across invocation locations.

The content globs are cwd-relative and the glob library snapshots
process.cwd() at import time - run from anywhere but docs/, the script
silently matched zero files and reported success. Pin the cwd to the
script's directory before dynamically importing the library (static
imports would hoist above the chdir).
Restructures the code-block/math/diagram documentation:

- code-blocks.mdx covers just code blocks, with syntax highlighting
  explained simple-first (install @blocknote/code-block, add the
  extension) and the extension architecture moved under Custom Syntax
  Highlighting.
- blocks/math.mdx and blocks/diagrams.mdx are new sidebar pages: setup,
  menu items & localization (compact - the wiring lives in the linked
  component pages and the embedded example), a live example, and a
  format-by-format Exporting section with the mapping setup and factory
  option signatures. The renderDiagram server-side story now exists
  once, on the diagram page, instead of on four export pages.
- The export pages keep short stubs linking to the block pages; the
  email page keeps image delivery (email-client knowledge) and moves
  the whole math/diagram section below the generic sections.
- custom-schemas/source-with-preview.mdx documents building your own
  preview blocks as a three-step walkthrough, with the complete
  implementation in a new embedded example
  (examples/06-custom-schema/11-source-with-preview: a CSV table block
  and a color chip inline content) - the example is type-checked and
  rendered, so the documented API can't silently rot. It also corrects
  the pattern's API docs, which described the pre-refactor per-spec
  extension options instead of meta.hasPreview.
- document-structure.mdx uses plainContentToString instead of showing
  hand-joined content items.
Editorial principles and the verification workflow for docs/content,
distilled from the restructure: simple-first ordering, one page per
searchable feature, single-sourced mechanisms, examples as the
compiled-and-rendered home of complete implementations, actionable
caveats only, plus the validate-links/dev-server/screenshot workflow
and fumadocs mechanics.
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Error Error Aug 12, 2026 3:31pm
blocknote-website Error Error Aug 12, 2026 3:31pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 82e60d29-fdbd-4c0e-863b-d08ff992f73a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes add documentation workflow guidance, expand math, diagram, code-block, and source-preview documentation, update export references, improve link validation, and add a runnable source-preview example to the playground.

Changes

Documentation and examples

Layer / File(s) Summary
Documentation workflow and validation
.claude/skills/docs-skill/SKILL.md, docs/validate-links.mjs
Added documentation authoring and verification guidance. Link validation now runs from the script directory.
Block features and export documentation
docs/content/docs/features/blocks/*, docs/content/docs/features/export/*, docs/content/docs/foundations/document-structure.mdx
Documented bundled code highlighting, math blocks, diagram blocks, export mappings, navigation entries, and plainContentToString.
Source-with-preview documentation and example
docs/content/docs/features/custom-schemas/source-with-preview.mdx, examples/06-custom-schema/11-source-with-preview/*, playground/src/examples.gen.tsx
Documented source-preview blocks and inline content. Added a CSV table and color-chip React example with playground metadata and styling.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: nperez0111

Poem

A rabbit reads the docs at dawn,
With syntax bright from dusk to morn.
CSV rows hop, colors gleam,
Preview popups shape the stream.
Links now guide each careful paw.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the documentation restructuring and dedicated pages added by the pull request.
Description check ✅ Passed The description clearly explains the rationale, major changes, documentation conventions, testing approach, and impact, despite omitting formal template headings and checklist items.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs-restructure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@2966

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@2966

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@2966

@blocknote/diagram-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/diagram-block@2966

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@2966

@blocknote/math-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/math-block@2966

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@2966

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@2966

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@2966

@blocknote/xl-ai

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-ai@2966

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@2966

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-email-exporter@2966

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@2966

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@2966

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@2966

commit: a05aec5

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-12 15:59 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
docs/content/docs/features/blocks/code-blocks.mdx (1)

64-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the missing imports to the setup snippet.

The snippet below this line uses useCreateBlockNote and BlockNoteSchema, but imports only createCodeBlockSpec, codeBlockOptions, and syntaxHighlighter. A reader who copies the block gets unresolved identifiers.

.claude/skills/docs-skill/SKILL.md in this same PR states: "Setup snippets are self-contained. A snippet the reader is meant to copy includes the imports for each symbol it uses — without them it doesn't work when copied."

📝 Proposed import additions
-import { createCodeBlockSpec } from "`@blocknote/core`";
+import { BlockNoteSchema, createCodeBlockSpec } from "`@blocknote/core`";
+import { useCreateBlockNote } from "`@blocknote/react`";
 import { codeBlockOptions, syntaxHighlighter } from "`@blocknote/code-block`";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/docs/features/blocks/code-blocks.mdx` around lines 64 - 70,
Update the code-block setup snippet using useCreateBlockNote and BlockNoteSchema
to include imports for both symbols, while preserving the existing imports for
createCodeBlockSpec, codeBlockOptions, and syntaxHighlighter so the copied
snippet is self-contained.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/content/docs/features/blocks/diagrams.mdx`:
- Line 71: Fix the incomplete sentence in the exporter introduction by adding a
verb after “The [DOCX exporter](/docs/features/export/docx)” so it clearly
states that the DOCX exporter is shown in the example, while preserving the
existing comparison with the PDF, ODT, and email exporters.
- Around line 34-43: Update the Mermaid syntax-highlighting guidance near the
editor snippet to accurately state that the current Mermaid grammar may produce
no visible highlighting because it only tokenizes Mermaid inside fenced Markdown
blocks; make this limitation actionable, or remove the instruction and snippet
if highlighting is not currently effective. Ensure the documentation matches the
behavior in createReactDiagramBlockSpec.

In `@examples/06-custom-schema/11-source-with-preview/index.html`:
- Line 1: Add the standard HTML5 doctype declaration before the opening html
element in the document, leaving the existing lang attribute and remaining
markup unchanged.

In `@examples/06-custom-schema/11-source-with-preview/main.tsx`:
- Line 4: Update the App import in the entry module to omit the .jsx extension,
using the existing ./src/App module specifier so Vite resolves the available
App.tsx file.

In `@examples/06-custom-schema/11-source-with-preview/package.json`:
- Around line 7-12: Update the build:prod script in package.json to replace the
direct tsc invocation with vp run lint, while preserving the subsequent Vite
production build command.

In `@examples/06-custom-schema/11-source-with-preview/vite.config.ts`:
- Around line 16-28: Update the path resolution in the Vite alias configuration:
change the existence check and both “@blocknote/core” and “@blocknote/react”
aliases from “../../packages” to “../../../packages” so they point to the
repository packages directory and remain enabled.

---

Nitpick comments:
In `@docs/content/docs/features/blocks/code-blocks.mdx`:
- Around line 64-70: Update the code-block setup snippet using
useCreateBlockNote and BlockNoteSchema to include imports for both symbols,
while preserving the existing imports for createCodeBlockSpec, codeBlockOptions,
and syntaxHighlighter so the copied snippet is self-contained.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e7e5e54e-9262-4d3b-88e7-ff04682b043a

📥 Commits

Reviewing files that changed from the base of the PR and between 37a9be7 and a05aec5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • .claude/skills/docs-skill/SKILL.md
  • docs/content/docs/features/blocks/code-blocks.mdx
  • docs/content/docs/features/blocks/diagrams.mdx
  • docs/content/docs/features/blocks/math.mdx
  • docs/content/docs/features/blocks/meta.json
  • docs/content/docs/features/custom-schemas/source-with-preview.mdx
  • docs/content/docs/features/export/docx.mdx
  • docs/content/docs/features/export/email.mdx
  • docs/content/docs/features/export/markdown.mdx
  • docs/content/docs/features/export/odt.mdx
  • docs/content/docs/features/export/pdf.mdx
  • docs/content/docs/foundations/document-structure.mdx
  • docs/validate-links.mjs
  • examples/06-custom-schema/11-source-with-preview/.bnexample.json
  • examples/06-custom-schema/11-source-with-preview/README.md
  • examples/06-custom-schema/11-source-with-preview/index.html
  • examples/06-custom-schema/11-source-with-preview/main.tsx
  • examples/06-custom-schema/11-source-with-preview/package.json
  • examples/06-custom-schema/11-source-with-preview/src/App.tsx
  • examples/06-custom-schema/11-source-with-preview/src/styles.css
  • examples/06-custom-schema/11-source-with-preview/tsconfig.json
  • examples/06-custom-schema/11-source-with-preview/vite-env.d.ts
  • examples/06-custom-schema/11-source-with-preview/vite.config.ts
  • playground/src/examples.gen.tsx
💤 Files with no reviewable changes (1)
  • docs/content/docs/features/export/markdown.mdx

Comment on lines +34 to +43
To highlight the Mermaid source in the popup, add the [syntax highlighting](/docs/features/blocks/code-blocks#syntax-highlighting) extension to your editor. The diagram block already declares its source language (`mermaid`), so no per-block configuration is needed:

```tsx
import { syntaxHighlighter } from "@blocknote/code-block";

const editor = useCreateBlockNote({
schema,
extensions: [syntaxHighlighter],
});
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The Mermaid highlighting instruction may not produce a visible result.

packages/diagram-block/src/block/createReactDiagramBlockSpec.tsx (lines 24-60) carries an explicit note next to the mermaid highlight declaration: the highlighting "currently has no visible effect", because Shiki's Mermaid grammar is a Markdown injection with injectionSelector: "L:text.html.markdown" that only tokenizes inside a fenced Markdown block.

This section tells the reader to install and wire @blocknote/code-block to highlight the Mermaid source. If the effect is not visible today, the reader adds a dependency for no result.

Either drop this section from the diagram page, or state the current limitation next to the instruction. .claude/skills/docs-skill/SKILL.md in this PR requires verifying snippets against the actual package source, and requires caveats to be actionable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/docs/features/blocks/diagrams.mdx` around lines 34 - 43, Update
the Mermaid syntax-highlighting guidance near the editor snippet to accurately
state that the current Mermaid grammar may produce no visible highlighting
because it only tokenizes Mermaid inside fenced Markdown blocks; make this
limitation actionable, or remove the instruction and snippet if highlighting is
not currently effective. Ensure the documentation matches the behavior in
createReactDiagramBlockSpec.


Diagrams export to every format BlockNote supports. [Markdown](/docs/features/export/markdown) works out of the box — diagrams export as ` ```mermaid ` fenced code blocks, their common Markdown notation.

The [PDF](/docs/features/export/pdf), [DOCX](/docs/features/export/docx), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters embed the diagram as an image via their mappings — they live as subpaths of this package, and each exports a `createDiagramBlockMapping` factory to spread into the exporter's default mappings. The [DOCX exporter](/docs/features/export/docx) shown here; the [PDF](/docs/features/export/pdf), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters work the same way with their respective subpaths:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the incomplete sentence.

"The DOCX exporter shown here" has no verb. The sentence introduces the code sample, so the break is visible at the point of highest reader attention.

✏️ Proposed wording
-The [PDF](/docs/features/export/pdf), [DOCX](/docs/features/export/docx), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters embed the diagram as an image via their mappings — they live as subpaths of this package, and each exports a `createDiagramBlockMapping` factory to spread into the exporter's default mappings. The [DOCX exporter](/docs/features/export/docx) shown here; the [PDF](/docs/features/export/pdf), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters work the same way with their respective subpaths:
+The [PDF](/docs/features/export/pdf), [DOCX](/docs/features/export/docx), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters embed the diagram as an image via their mappings — they live as subpaths of this package, and each exports a `createDiagramBlockMapping` factory to spread into the exporter's default mappings. The DOCX exporter is shown here; the PDF, ODT, and email exporters work the same way with their respective subpaths:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The [PDF](/docs/features/export/pdf), [DOCX](/docs/features/export/docx), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters embed the diagram as an image via their mappings — they live as subpaths of this package, and each exports a `createDiagramBlockMapping` factory to spread into the exporter's default mappings. The [DOCX exporter](/docs/features/export/docx) shown here; the [PDF](/docs/features/export/pdf), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters work the same way with their respective subpaths:
The [PDF](/docs/features/export/pdf), [DOCX](/docs/features/export/docx), [ODT](/docs/features/export/odt), and [email](/docs/features/export/email) exporters embed the diagram as an image via their mappings — they live as subpaths of this package, and each exports a `createDiagramBlockMapping` factory to spread into the exporter's default mappings. The DOCX exporter is shown here; the PDF, ODT, and email exporters work the same way with their respective subpaths:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/docs/features/blocks/diagrams.mdx` at line 71, Fix the
incomplete sentence in the exporter introduction by adding a verb after “The
[DOCX exporter](/docs/features/export/docx)” so it clearly states that the DOCX
exporter is shown in the example, while preserving the existing comparison with
the PDF, ODT, and email exporters.

@@ -0,0 +1,14 @@
<html lang="en">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add the HTML doctype.

Line 1 starts the document without <!doctype html>. Browsers can enter quirks mode and render the example differently.

Proposed fix
+<!doctype html>
 <html lang="en">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<html lang="en">
<!doctype html>
<html lang="en">
🧰 Tools
🪛 HTMLHint (1.9.2)

[error] 1-1: Doctype must be declared before any non-comment content.

(doctype-first)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/06-custom-schema/11-source-with-preview/index.html` at line 1, Add
the standard HTML5 doctype declaration before the opening html element in the
document, leaving the existing lang attribute and remaining markup unchanged.

Source: Linters/SAST tools

// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
import React from "react";
import { createRoot } from "react-dom/client";
import App from "./src/App.jsx";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

vp run lint

Repository: TypeCellOS/BlockNote

Length of output: 198


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- candidate files ---'
fd -a . examples/06-custom-schema/11-source-with-preview

printf '%s\n' '--- entry point ---'
cat -n examples/06-custom-schema/11-source-with-preview/main.tsx

printf '%s\n' '--- package and Vite configuration references ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' \
  '11-source-with-preview|resolve|extensions|vite|App\.jsx|App\.tsx' \
  examples/06-custom-schema/11-source-with-preview package.json pnpm-workspace.yaml vite.config.* 2>/dev/null || true

Repository: TypeCellOS/BlockNote

Length of output: 4665


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- example package ---'
cat -n examples/06-custom-schema/11-source-with-preview/package.json

printf '%s\n' '--- example Vite config ---'
cat -n examples/06-custom-schema/11-source-with-preview/vite.config.ts

printf '%s\n' '--- example TypeScript config ---'
cat -n examples/06-custom-schema/11-source-with-preview/tsconfig.json

printf '%s\n' '--- exact specifier resolution probe ---'
python3 - <<'PY'
from pathlib import Path

root = Path("examples/06-custom-schema/11-source-with-preview")
specifier = root / "src" / "App.jsx"
fallbacks = [specifier.with_suffix(ext) for ext in (".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json")]

print("explicit path exists:", specifier.exists())
print("Vite-default fallback candidates:")
for path in fallbacks:
    print(f"  {path.relative_to(root)}: {path.exists()}")
PY

Repository: TypeCellOS/BlockNote

Length of output: 3650


🌐 Web query:

Vite resolve.extensions default explicit file extension resolution documentation

💡 Result:

In Vite, the resolve.extensions configuration option defines the list of file extensions that Vite will automatically attempt to resolve when an import statement omits a file extension [1][2]. The default value for resolve.extensions is: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'] [1][3] Key details regarding this behavior: - Automatic Resolution: When you import a file without specifying its extension (e.g., import './myFile'), Vite iterates through this list in order to find a matching file on the filesystem [1][4]. - Best Practices: While Vite supports this automatic resolution, it is officially recommended not to omit extensions for custom file types (such as.vue files) [1][2]. Omitting extensions for such types can interfere with IDE and type-checking support [1][2]. - Configuration: You can override this default list in your vite.config.js or vite.config.ts file under the resolve property: // vite.config.js export default { resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'] } } Note that this configuration affects how imports are resolved during development and bundling [5][4]. For production-ready code, explicit extensions are generally preferred to avoid ambiguity and improve build performance.

Citations:


Import the existing application module.

src/App.jsx does not exist. Vite only applies extension fallback when the import omits its extension. Use ./src/App so Vite resolves src/App.tsx.

Proposed fix
-import App from "./src/App.jsx";
+import App from "./src/App";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import App from "./src/App.jsx";
import App from "./src/App";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/06-custom-schema/11-source-with-preview/main.tsx` at line 4, Update
the App import in the entry module to omit the .jsx extension, using the
existing ./src/App module specifier so Vite resolves the available App.tsx file.

Comment on lines +7 to +12
"scripts": {
"start": "vite",
"dev": "vite",
"build:prod": "tsc && vite build",
"preview": "vite preview"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Replace the direct TypeScript command.

Line 10 runs tsc directly. Use vp run lint for type checking, then run Vite for the production bundle.

Proposed fix
-    "build:prod": "tsc && vite build",
+    "build:prod": "vp run lint && vite build",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"scripts": {
"start": "vite",
"dev": "vite",
"build:prod": "tsc && vite build",
"preview": "vite preview"
},
"scripts": {
"start": "vite",
"dev": "vite",
"build:prod": "vp run lint && vite build",
"preview": "vite preview"
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/06-custom-schema/11-source-with-preview/package.json` around lines 7
- 12, Update the build:prod script in package.json to replace the direct tsc
invocation with vp run lint, while preserving the subsequent Vite production
build command.

Source: Coding guidelines

Comment on lines +16 to +28
!fs.existsSync(path.resolve(__dirname, "../../packages/core/src"))
? {}
: ({
// Comment out the lines below to load a built version of blocknote
// or, keep as is to load live from sources with live reload working
"@blocknote/core": path.resolve(
__dirname,
"../../packages/core/src/",
),
"@blocknote/react": path.resolve(
__dirname,
"../../packages/react/src/",
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

example_dir="examples/06-custom-schema/11-source-with-preview"

test -d "$example_dir/../../../packages/core/src"
test -d "$example_dir/../../../packages/react/src"

vp run lint

Repository: TypeCellOS/BlockNote

Length of output: 198


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

example = Path("examples/06-custom-schema/11-source-with-preview").resolve()
repo = Path.cwd().resolve()

print("repo:", repo)
print("example:", example)
for rel in ("../../packages/core/src", "../../packages/react/src",
            "../../../packages/core/src", "../../../packages/react/src"):
    target = (example / rel).resolve()
    print(f"{rel} -> {target} exists={target.is_dir()}")

config = Path("examples/06-custom-schema/11-source-with-preview/vite.config.ts")
print("\nconfig references:")
for i, line in enumerate(config.read_text().splitlines(), 1):
    if 16 <= i <= 28:
        print(f"{i}: {line}")

tsconfig = Path("examples/06-custom-schema/11-source-with-preview/tsconfig.json")
print("\ntsconfig references:")
for i, line in enumerate(tsconfig.read_text().splitlines(), 1):
    if "packages" in line:
        print(f"{i}: {line}")
PY

if command -v vp >/dev/null 2>&1; then
  vp run lint
else
  echo "vp: unavailable; lint not run"
fi

Repository: TypeCellOS/BlockNote

Length of output: 1323


Correct the local source alias paths.

The ../../packages paths resolve to examples/packages, so the aliases are disabled. Use ../../../packages for the existence check and both source aliases.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/06-custom-schema/11-source-with-preview/vite.config.ts` around lines
16 - 28, Update the path resolution in the Vite alias configuration: change the
existence check and both “@blocknote/core” and “@blocknote/react” aliases from
“../../packages” to “../../../packages” so they point to the repository packages
directory and remain enabled.

Remove the redundant @blocknote/shared package dependency from packages
and examples, standardizing on the @shared path alias (tsconfig paths +
bundler alias) plus a TypeScript project reference to ../shared, matching
the @blocknote/tests package. The shared directory is private, unbuilt,
and never imported by its package name.

The dev-scripts react template now always injects the @shared alias/paths
(only active in local monorepo dev), regenerating every example's
tsconfig.json and vite.config.ts. Updates shared/README.md to document
the wiring.
Replace the @typescript/native-preview (tsgo) compiler with the native
TypeScript 7 compiler shipped as the regular typescript package. Bump
typescript to ^7.0.2 across all packages and swap tsgo for tsc in every
build command and script.

Upgrade vite-plus to ^0.2.9 (oxlint 1.77, oxfmt 0.62, @oxlint/plugins
1.73) and oxlint-tsgolint to ^7.0.2001. Scope shared/tsconfig.json's
include/exclude per the oxlint type-aware performance guidance so the
type-aware lint programs stay small, and fix a floating promise in
scripts/release.mjs flagged by no-floating-promises.
# Conflicts:
#	docs/content/docs/features/blocks/code-blocks.mdx
Base automatically changed from math-diagram-exporters to code-block-previews August 12, 2026 15:59
@nperez0111
nperez0111 merged commit f7fa5c6 into main Aug 12, 2026
11 of 29 checks passed
@nperez0111
nperez0111 deleted the docs-restructure branch August 12, 2026 15:59
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

Successfully merging this pull request may close these issues.

2 participants