MCPcopy Index your code
hub / github.com/deepnote/deepnote / stripMarkdownFromTextBlock

Function stripMarkdownFromTextBlock

packages/blocks/src/blocks/text-blocks.ts:136–169  ·  view source on GitHub ↗
(block: TextBlock)

Source from the content-addressed store, hash-verified

134}
135
136export function stripMarkdownFromTextBlock(block: TextBlock): string {
137 const content = block.content ?? ''
138
139 if (block.type === 'text-cell-h1') {
140 return content.replace(/^#\s+/, '').trim()
141 }
142
143 if (block.type === 'text-cell-h2') {
144 return content.replace(/^##\s+/, '').trim()
145 }
146
147 if (block.type === 'text-cell-h3') {
148 // Also handle h4-h6 markdown (all map to h3 in Deepnote)
149 return content.replace(/^#{3,6}\s+/, '').trim()
150 }
151
152 if (block.type === 'text-cell-bullet') {
153 return content.replace(/^-+\s+/, '').trim()
154 }
155
156 if (block.type === 'text-cell-todo') {
157 return content.replace(/^-+\s+\[.\]\s+/, '').trim()
158 }
159
160 if (block.type === 'text-cell-callout') {
161 return content.replace(/^>\s+/, '').trim()
162 }
163
164 if (block.type === 'text-cell-p') {
165 return content.trim()
166 }
167
168 throw new UnsupportedBlockTypeError('Unhandled block type.')
169}
170
171export function createMarkdownForSeparatorBlock(_block: SeparatorBlock): string {
172 return '<hr>'

Callers 1

stripMarkdownFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected