:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(notebooks): convert pasted markdown tables into real tables (#60985)
Raquel Smith8b51dbea7fbf
diff --git a/frontend/src/lib/utils/expandFlattenedMarkdownTables.test.ts b/frontend/src/lib/utils/expandFlattenedMarkdownTables.test.tsindex e42d5c89318a..9d9dcbe8a5de 100644--- a/frontend/src/lib/utils/expandFlattenedMarkdownTables.test.ts+++ b/frontend/src/lib/utils/expandFlattenedMarkdownTables.test.ts@@ -13,6 +13,18 @@ describe('expandFlattenedMarkdownTables', () => {)})+ it('expands a flattened table whose rows are glued together with no whitespace', () => {+ const input = '| Month | Boost | Scale ||-------|-------|-------|| Jul 2025 | 54 | 20 || Aug 2025 | 59 | 26 |'+ expect(expandFlattenedMarkdownTables(input)).toBe(+ [+ '| Month | Boost | Scale |',+ '|-------|-------|-------|',+ '| Jul 2025 | 54 | 20 |',+ '| Aug 2025 | 59 | 26 |',+ ].join('\n')+ )+ })+it('handles alignment markers in the delimiter row', () => {const input = '| a | b | c | | :--- | :---: | ---: | | 1 | 2 | 3 |'expect(expandFlattenedMarkdownTables(input)).toBe(diff --git a/frontend/src/lib/utils/expandFlattenedMarkdownTables.ts b/frontend/src/lib/utils/expandFlattenedMarkdownTables.tsindex f519bbe5359b..27dec740d5cc 100644--- a/frontend/src/lib/utils/expandFlattenedMarkdownTables.ts+++ b/frontend/src/lib/utils/expandFlattenedMarkdownTables.ts@@ -1,5 +1,8 @@const TABLE_DELIMITER_SEGMENT_RE = /^\|(?:\s*:?-{2,}:?\s*\|)+\s*$/-const FLATTENED_TABLE_ROW_BOUNDARY_RE = /(?<=\|)\s+(?=\|)/+// Matches the boundary between two flattened rows: a closing `|` directly followed by the+// next row's opening `|`. The whitespace is optional because some sources (e.g. AI chat+// output) glue rows together with no space (`...Total ||-------|...`) while others keep one.+const FLATTENED_TABLE_ROW_BOUNDARY_RE = /(?<=\|)\s*(?=\|)/// Slack, ChatGPT, Notion etc. strip newlines between table rows on plain-text copy.// Only splits when a delimiter row (`|---|---|`) is present, so prose with `|` is safe.diff --git a/frontend/src/lib/utils/parseMarkdownToTipTap.ts b/frontend/src/lib/utils/parseMarkdownToTipTap.tsnew file mode 100644index 000000000000..bc8dded674d1--- /dev/null+++ b/frontend/src/lib/utils/parseMarkdownToTipTap.ts@@ -0,0 +1,32 @@+import { JSONContent } from '@tiptap/core'+import { Link } from '@tiptap/extension-link'+import { TaskItem, TaskList } from '@tiptap/extension-list'+import { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'+import { MarkdownManager } from '@tiptap/markdown'+import StarterKit from '@tiptap/starter-kit'++import { expandFlattenedMarkdownTables } from 'lib/utils/expandFlattenedMarkdownTables'++const markdownManager = new MarkdownManager({+ extensions: [+ StarterKit.configure({ link: false }),+ Link,+ Table,+ TableRow,+ TableHeader,+ TableCell,+ TaskList,+ TaskItem.configure({ nested: true }),+ ],+})++// Parse a markdown string into TipTap JSONContent nodes, first expanding any flattened+// tables (rows glued onto one line) so they render as real tables. Shared by the paste+// handler and the notebook migration so both stay consistent.+export function parseMarkdownToTipTap(markdown: string): JSONContent[] {+ if (!markdown || markdown.trim() === '') {+ return []+ }+ const doc = markdownManager.parse(expandFlattenedMarkdownTables(markdown)) as JSONContent+ return (doc.content as JSONContent[]) || []+}diff --git a/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.test.ts b/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.test.tsindex 915c1fc8fd51..ee7663046af0 100644--- a/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.test.ts+++ b/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.test.ts@@ -1,8 +1,10 @@+import { parseMarkdownToTipTap } from 'lib/utils/parseMarkdownToTipTap'+import {detectMarkdown,detectTabularFormat,isTabularData,- parseMarkdownToTipTap,+ parseMarkdownPasteContent,parseTabularDataToTipTapTable,} from './DropAndPasteHandlerExtension'@@ -229,5 +231,57 @@ describe('DropAndPasteHandlerExtension', () => {const lastRow = result[0].content?.[2]expect(lastRow?.content?.[1].content?.[0].content?.[0].text).toBe('4')})++ it('parses an AI-formatted flattened table whose rows are glued with no whitespace', () => {+ const result = parseMarkdownToTipTap('| Month | Boost ||-------|-------|| Jul 2025 | 54 || Aug 2025 | 59 |')++ expect(result[0].type).toBe('table')+ expect(result[0].content).toHaveLength(3)+ const headerRow = result[0].content?.[0]+ expect(headerRow?.content?.[0].type).toBe('tableHeader')+ expect(headerRow?.content?.[0].content?.[0].content?.[0].text).toBe('Month')+ const lastRow = result[0].content?.[2]+ expect(lastRow?.content?.[0].content?.[0].content?.[0].text).toBe('Aug 2025')+ expect(lastRow?.content?.[1].content?.[0].content?.[0].text).toBe('59')+ })+ })++ describe('parseMarkdownPasteContent', () => {+ // A flattened markdown table glued with no whitespace, as AI chats / rendered docs+ // put it on the clipboard. The matching HTML carries it as plain pipe-text, not a+ // real <table>, so without the table exception it would be lost on paste.+ const FLATTENED_TABLE =+ '| Month | Boost | Scale | Teams | Total ||-------|-------|-------|-------|-------|| Jul 2025 | 54 | 20 | — | 74 || Aug 2025 | 59 | 26 | — | 85 |'++ it('parses a flattened table even when an HTML representation is present', () => {+ const result = parseMarkdownPasteContent(FLATTENED_TABLE, '<meta charset="utf-8"><span>| Month |...</span>')++ expect(result).not.toBeNull()+ expect(result![0].type).toBe('table')+ expect(result![0].content).toHaveLength(3)+ })++ it('parses a flattened table when there is no HTML representation', () => {+ const result = parseMarkdownPasteContent(FLATTENED_TABLE, undefined)++ expect(result).not.toBeNull()+ expect(result![0].type).toBe('table')+ })++ it('defers to the default paste for non-table markdown when HTML is present', () => {+ expect(parseMarkdownPasteContent('# Title\n\n- one\n- two', '<h1>Title</h1>')).toBeNull()+ })++ it('parses non-table markdown when there is no HTML representation', () => {+ const result = parseMarkdownPasteContent('# Title', undefined)++ expect(result).not.toBeNull()+ expect(result![0].type).toBe('heading')+ })++ it('returns null for plain text that is not markdown', () => {+ expect(parseMarkdownPasteContent('just some plain text', undefined)).toBeNull()+ expect(parseMarkdownPasteContent('', undefined)).toBeNull()+ })})})diff --git a/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.tsx b/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.tsxindex 02536d4d53f2..e402caa6d562 100644--- a/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.tsx+++ b/frontend/src/scenes/notebooks/Notebook/DropAndPasteHandlerExtension.tsx@@ -1,17 +1,12 @@import { JSONContent } from '@tiptap/core'-import { Link } from '@tiptap/extension-link'-import { TaskItem, TaskList } from '@tiptap/extension-list'-import { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'-import { MarkdownManager } from '@tiptap/markdown'import { Plugin, PluginKey } from '@tiptap/pm/state'import { Extension } from '@tiptap/react'-import StarterKit from '@tiptap/starter-kit'import Papa from 'papaparse'import posthog from 'posthog-js'import { lemonToast } from '@posthog/lemon-ui'-import { expandFlattenedMarkdownTables } from 'lib/utils/expandFlattenedMarkdownTables'+import { parseMarkdownToTipTap } from 'lib/utils/parseMarkdownToTipTap'import { NotebookNodeType } from '../types'@@ -85,25 +80,30 @@ export function detectMarkdown(text: string): boolean {return MARKDOWN_BLOCK_PATTERNS.some((pattern) => pattern.test(text))}-const markdownManager = new MarkdownManager({- extensions: [- StarterKit.configure({ link: false }),- Link,- Table,- TableRow,- TableHeader,- TableCell,- TaskList,- TaskItem.configure({ nested: true }),- ],-})--export function parseMarkdownToTipTap(markdown: string): JSONContent[] {- if (!markdown || markdown.trim() === '') {- return []+// Decide what to insert when pasted plain text looks like markdown. Returns the parsed+// nodes to insert, or null to defer to tiptap's default paste. We defer when the clipboard+// also has an HTML representation (tiptap preserves its rendered structure) UNLESS the+// markdown parses to a table: rich sources (AI chats, rendered docs) put flattened tables+// on the clipboard as plain pipe-text in their HTML, which the default paste renders as a+// paragraph and loses the table. Real <table> HTML is handled before this is ever called.+export function parseMarkdownPasteContent(text: string, html: string | undefined): JSONContent[] | null {+ if (!text || !detectMarkdown(text)) {+ return null+ }+ let parsed: JSONContent[]+ try {+ parsed = parseMarkdownToTipTap(text)+ } catch {+ return null+ }+ if (parsed.length === 0) {+ return null}- const doc = markdownManager.parse(expandFlattenedMarkdownTables(markdown)) as JSONContent- return (doc.content as JSONContent[]) || []+ const hasTable = parsed.some((node) => node.type === 'table')+ if (html && !hasTable) {+ return null+ }+ return parsed}export const DropAndPasteHandlerExtension = Extension.create({@@ -221,22 +221,17 @@ export const DropAndPasteHandlerExtension = Extension.create({return true}- // Detect markdown source in plain-text pastes. Only run when there is no- // rich HTML representation — if HTML is present, tiptap's default paste- // already preserves the rendered structure.- if (!html && text && detectMarkdown(text)) {- try {- const parsed = parseMarkdownToTipTap(text)- if (parsed.length > 0) {- this.editor.chain().focus().insertContent(parsed).run()- posthog.capture('notebook markdown pasted', {- length: text.length,- blocks: parsed.length,- })- return true- }- } catch {- // Fall through to default plain-text paste if markdown parsing fails+ // Detect markdown source in plain-text pastes (see parseMarkdownPasteContent+ // for how HTML pastes and flattened tables are handled).+ if (text) {+ const parsed = parseMarkdownPasteContent(text, html)+ if (parsed) {+ this.editor.chain().focus().insertContent(parsed).run()+ posthog.capture('notebook markdown pasted', {+ length: text.length,+ blocks: parsed.length,+ })+ return true}}diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/convertMarkdownTablesInContent.test.ts b/frontend/src/scenes/notebooks/Notebook/migrations/convertMarkdownTablesInContent.test.tsnew file mode 100644index 000000000000..2dd72dfbe1a4--- /dev/null+++ b/frontend/src/scenes/notebooks/Notebook/migrations/convertMarkdownTablesInContent.test.ts@@ -0,0 +1,129 @@+import { JSONContent } from '@tiptap/core'++import { convertMarkdownTablesInContent } from './convertMarkdownTablesInContent'++function paragraph(text: string): JSONContent {+ return { type: 'paragraph', content: [{ type: 'text', text }] }+}++describe('convertMarkdownTablesInContent', () => {+ it('rewrites a paragraph that contains a flattened table into a real table node', () => {+ const result = convertMarkdownTablesInContent([paragraph('| a | b | |---|---| | 1 | 2 |')])++ expect(result).toHaveLength(1)+ expect(result[0].type).toBe('table')+ expect(result[0].content).toHaveLength(2)+ expect(result[0].content?.[0].content?.[0].type).toBe('tableHeader')+ expect(result[0].content?.[1].content?.[1].content?.[0].content?.[0].text).toBe('2')+ })++ it('rewrites consecutive paragraphs that form a multi-line markdown table', () => {+ const result = convertMarkdownTablesInContent([+ paragraph('| Period | Boost % | Scale % |'),+ paragraph('|--------|---------|---------|'),+ paragraph('| Jul 2025 | ~71% | ~29% |'),+ paragraph('| Aug 2025 | 70% | 30% |'),+ ])++ expect(result).toHaveLength(1)+ expect(result[0].type).toBe('table')+ // header row + 2 data rows+ expect(result[0].content).toHaveLength(3)+ expect(result[0].content?.[0].content?.[0].type).toBe('tableHeader')+ expect(result[0].content?.[0].content?.[0].content?.[0].content?.[0].text).toBe('Period')+ expect(result[0].content?.[2].content?.[2].content?.[0].content?.[0].text).toBe('30%')+ })++ it('preserves surrounding nodes and only rewrites the table run', () => {+ const heading: JSONContent = {+ type: 'heading',+ attrs: { level: 2 },+ content: [{ type: 'text', text: 'Title' }],+ }+ const trailing = paragraph('trailing paragraph')++ const result = convertMarkdownTablesInContent([+ heading,+ paragraph('| a | b |'),+ paragraph('|---|---|'),+ paragraph('| 1 | 2 |'),+ trailing,+ ])++ expect(result).toHaveLength(3)+ expect(result[0]).toBe(heading)+ expect(result[1].type).toBe('table')+ expect(result[2]).toBe(trailing)+ })++ it('preserves surrounding nodes around a flattened single-line table', () => {+ const heading: JSONContent = {+ type: 'heading',+ attrs: { level: 2 },+ content: [{ type: 'text', text: 'Title' }],+ }+ const trailing = paragraph('trailing paragraph')++ const result = convertMarkdownTablesInContent([heading, paragraph('| a | b | |---|---| | 1 | 2 |'), trailing])++ expect(result).toHaveLength(3)+ expect(result[0]).toBe(heading)+ expect(result[1].type).toBe('table')+ expect(result[2]).toBe(trailing)+ })++ it('converts two separate tables split by a non-table paragraph', () => {+ const result = convertMarkdownTablesInContent([+ paragraph('| a | b |'),+ paragraph('|---|---|'),+ paragraph('| 1 | 2 |'),+ paragraph('some prose in between'),+ paragraph('| c | d |'),+ paragraph('|---|---|'),+ paragraph('| 3 | 4 |'),+ ])++ expect(result).toHaveLength(3)+ expect(result[0].type).toBe('table')+ expect(result[1]).toEqual(paragraph('some prose in between'))+ expect(result[2].type).toBe('table')+ })++ it.each([+ { nodes: [paragraph('plain prose with no table')], desc: 'plain prose' },+ { nodes: [paragraph('see |foo| and |bar|')], desc: 'inline pipes without a delimiter row' },+ { nodes: [paragraph('| a | b |')], desc: 'a lone table row with no delimiter' },+ {+ nodes: [paragraph('| a | b |'), paragraph('| 1 | 2 |')],+ desc: 'consecutive pipe rows with no delimiter',+ },+ {+ nodes: [{ type: 'heading', attrs: { level: 1 }, content: [{ type: 'text', text: '# heading' }] }],+ desc: 'non-paragraph node',+ },+ {+ nodes: [+ {+ type: 'paragraph',+ content: [{ type: 'text', text: '| a | b | |---|---| | 1 | 2 |', marks: [{ type: 'bold' }] }],+ },+ ],+ desc: 'flattened table inside a marked text run',+ },+ {+ nodes: [+ {+ type: 'paragraph',+ content: [+ { type: 'text', text: '| a | b |' },+ { type: 'hardBreak' },+ { type: 'text', text: '|---|---|' },+ ],+ },+ ],+ desc: 'paragraph with mixed non-text children',+ },+ ])('leaves $desc untouched', ({ nodes }) => {+ expect(convertMarkdownTablesInContent(nodes)).toEqual(nodes)+ })+})diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/convertMarkdownTablesInContent.ts b/frontend/src/scenes/notebooks/Notebook/migrations/convertMarkdownTablesInContent.tsnew file mode 100644index 000000000000..943e6404db2c--- /dev/null+++ b/frontend/src/scenes/notebooks/Notebook/migrations/convertMarkdownTablesInContent.ts@@ -0,0 +1,68 @@+import { JSONContent } from '@tiptap/core'++import { parseMarkdownToTipTap } from 'lib/utils/parseMarkdownToTipTap'++// Plain text of an unstyled, text-only paragraph. Returns null for anything else+// (non-paragraphs, empty paragraphs, paragraphs with marks or non-text children) so+// we never rewrite a node whose meaning depends on more than its raw text.+function paragraphPlainText(node: JSONContent): string | null {+ if (node.type !== 'paragraph' || !Array.isArray(node.content)) {+ return null+ }+ let out = ''+ for (const child of node.content) {+ if (child.type !== 'text' || typeof child.text !== 'string') {+ return null+ }+ if (child.marks && child.marks.length > 0) {+ return null+ }+ out += child.text+ }+ return out+}++// A line that could be part of a markdown table: trimmed text wrapped in pipes with+// content between them. The real gate is whether the grouped run parses to a table,+// so this only needs to be loose enough to collect candidate rows.+function looksLikeTableLine(text: string): boolean {+ return /^\|.+\|$/.test(text.trim())+}++// Markdown tables typed directly into the editor land as one paragraph per row (and a+// table flattened onto a single line lands as one paragraph). Neither renders as a table.+// Group consecutive table-like paragraphs, parse them as markdown, and replace the run+// with the resulting table node when it parses cleanly.+export function convertMarkdownTablesInContent(content: JSONContent[]): JSONContent[] {+ const result: JSONContent[] = []+ let i = 0++ while (i < content.length) {+ const text = paragraphPlainText(content[i])+ if (text === null || !looksLikeTableLine(text)) {+ result.push(content[i])+ i+++ continue+ }++ // Collect the maximal run of consecutive table-like paragraphs.+ const run: JSONContent[] = []+ const texts: string[] = []+ while (i < content.length) {+ const lineText = paragraphPlainText(content[i])+ if (lineText === null || !looksLikeTableLine(lineText)) {+ break+ }+ run.push(content[i])+ texts.push(lineText.trim())+ i+++ }++ const parsedContent = parseMarkdownToTipTap(texts.join('\n'))+ const isTable = parsedContent.length > 0 && parsedContent.every((node) => node.type === 'table')++ result.push(...(isTable ? parsedContent : run))+ }++ return result+}diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/expandFlattenedTablesInContent.test.ts b/frontend/src/scenes/notebooks/Notebook/migrations/expandFlattenedTablesInContent.test.tsdeleted file mode 100644index 20f598b0d5f0..000000000000--- a/frontend/src/scenes/notebooks/Notebook/migrations/expandFlattenedTablesInContent.test.ts+++ /dev/null@@ -1,64 +0,0 @@-import { JSONContent } from '@tiptap/core'--import { expandFlattenedTablesInContent } from './expandFlattenedTablesInContent'--function paragraph(text: string): JSONContent {- return { type: 'paragraph', content: [{ type: 'text', text }] }-}--describe('expandFlattenedTablesInContent', () => {- it('rewrites a paragraph that contains a flattened table into a real table node', () => {- const result = expandFlattenedTablesInContent([paragraph('| a | b | |---|---| | 1 | 2 |')])-- expect(result).toHaveLength(1)- expect(result[0].type).toBe('table')- expect(result[0].content).toHaveLength(2)- expect(result[0].content?.[0].content?.[0].type).toBe('tableHeader')- expect(result[0].content?.[1].content?.[1].content?.[0].content?.[0].text).toBe('2')- })-- it('preserves surrounding nodes and only rewrites the flattened paragraph', () => {- const heading: JSONContent = {- type: 'heading',- attrs: { level: 2 },- content: [{ type: 'text', text: 'Title' }],- }- const trailing = paragraph('trailing paragraph')-- const result = expandFlattenedTablesInContent([heading, paragraph('| a | b | |---|---| | 1 | 2 |'), trailing])-- expect(result).toHaveLength(3)- expect(result[0]).toBe(heading)- expect(result[1].type).toBe('table')- expect(result[2]).toBe(trailing)- })-- it.each([- { node: paragraph('plain prose with no table'), desc: 'plain prose' },- { node: paragraph('see |foo| and |bar|'), desc: 'inline pipes without a delimiter row' },- {- node: { type: 'heading', attrs: { level: 1 }, content: [{ type: 'text', text: '# heading' }] },- desc: 'non-paragraph node',- },- {- node: {- type: 'paragraph',- content: [{ type: 'text', text: '| a | b | |---|---| | 1 | 2 |', marks: [{ type: 'bold' }] }],- },- desc: 'flattened table inside a marked text run',- },- {- node: {- type: 'paragraph',- content: [- { type: 'text', text: '| a | b |' },- { type: 'hardBreak' },- { type: 'text', text: '|---|---|' },- ],- },- desc: 'paragraph with mixed non-text children',- },- ])('leaves $desc untouched', ({ node }) => {- expect(expandFlattenedTablesInContent([node])).toEqual([node])- })-})diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/expandFlattenedTablesInContent.ts b/frontend/src/scenes/notebooks/Notebook/migrations/expandFlattenedTablesInContent.tsdeleted file mode 100644index 31a8c91fe0f7..000000000000--- a/frontend/src/scenes/notebooks/Notebook/migrations/expandFlattenedTablesInContent.ts+++ /dev/null@@ -1,46 +0,0 @@-import { JSONContent } from '@tiptap/core'-import { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'-import { MarkdownManager } from '@tiptap/markdown'-import StarterKit from '@tiptap/starter-kit'--import { expandFlattenedMarkdownTables } from 'lib/utils/expandFlattenedMarkdownTables'--const markdownManager = new MarkdownManager({- extensions: [StarterKit, Table, TableRow, TableHeader, TableCell],-})--function paragraphPlainText(node: JSONContent): string | null {- if (node.type !== 'paragraph' || !Array.isArray(node.content)) {- return null- }- let out = ''- for (const child of node.content) {- if (child.type !== 'text' || typeof child.text !== 'string') {- return null- }- if (child.marks && child.marks.length > 0) {- return null- }- out += child.text- }- return out-}--export function expandFlattenedTablesInContent(content: JSONContent[]): JSONContent[] {- return content.flatMap((node) => {- const text = paragraphPlainText(node)- if (text === null) {- return [node]- }- const expanded = expandFlattenedMarkdownTables(text)- if (expanded === text) {- return [node]- }- const parsed = markdownManager.parse(expanded) as JSONContent- const parsedContent = (parsed.content as JSONContent[] | undefined) ?? []- if (parsedContent.length === 0) {- return [node]- }- return parsedContent- })-}diff --git a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.tsindex d02f33270900..14c7220734e8 100644--- a/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts+++ b/frontend/src/scenes/notebooks/Notebook/migrations/migrate.ts@@ -39,13 +39,13 @@ import {import { checkLatestVersionsOnQuery } from '~/queries/utils'import { FunnelExclusionLegacy, LegacyRecordingFilters } from '~/types'-import { expandFlattenedTablesInContent } from './expandFlattenedTablesInContent'+import { convertMarkdownTablesInContent } from './convertMarkdownTablesInContent'// NOTE: Increment this number when you add a new content migration// It will bust the cache on the localContent in the notebookLogic// so that the latest content will fall back to the remote content which// is filtered through the migrate function below that ensures integrity-export const NOTEBOOKS_VERSION = '2'+export const NOTEBOOKS_VERSION = '3'export interface MigrateOptions {/**@@ -66,7 +66,7 @@ export async function migrate(notebook: NotebookType, options: MigrateOptions =content = convertInsightQueryStringsToObjects(content)content = convertInsightQueriesToNewSchema(content)content = convertPlaylistFiltersToUniversalFilters(content)- content = expandFlattenedTablesInContent(content)+ content = convertMarkdownTablesInContent(content)if (!options.skipApiUpgrade) {content = await upgradeQueryNode(content)}