can parse dollar signs

This commit is contained in:
Nate Kelley 2025-08-11 15:10:55 -06:00
parent 438bec4ce4
commit 48fa337303
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 55 additions and 2 deletions

View File

@ -28,7 +28,7 @@ import { LineHeightKit } from './plugins/line-height-kit';
import { LinkKit } from './plugins/link-kit'; import { LinkKit } from './plugins/link-kit';
import { ListKit } from './plugins/list-kit'; import { ListKit } from './plugins/list-kit';
import { MarkdownKit } from './plugins/markdown-kit'; import { MarkdownKit } from './plugins/markdown-kit';
import { MathKit } from './plugins/math-kit'; // import { MathKit } from './plugins/math-kit';
import { MediaKit } from './plugins/media-kit'; import { MediaKit } from './plugins/media-kit';
import { MentionKit } from './plugins/mention-kit'; import { MentionKit } from './plugins/mention-kit';
import { SlashKit } from './plugins/slash-kit'; import { SlashKit } from './plugins/slash-kit';
@ -58,7 +58,7 @@ export const EditorKit = [
...MediaKit, ...MediaKit,
...CalloutKit, ...CalloutKit,
...ColumnKit, ...ColumnKit,
...MathKit, // ...MathKit,
...DateKit, ...DateKit,
...LinkKit, ...LinkKit,
...MentionKit, ...MentionKit,

View File

@ -201,6 +201,59 @@ Here's an unordered list:
expect((thirdElement as ParagraphElement).listStyleType).toBe('disc'); expect((thirdElement as ParagraphElement).listStyleType).toBe('disc');
expect(thirdElement.children[0]).toEqual({ text: 'Bullet list item 2' }); expect(thirdElement.children[0]).toEqual({ text: 'Bullet list item 2' });
}); });
it('dollar sign', async () => {
const markdown = `Top performers balance volume and value across purchase contexts:
- **High-volume replacement parts** (1,088 orders, $16M revenue)
- **High-value maintenance & upgrade** (535 orders, $21.4M revenue)`;
const platejs = await markdownToPlatejs(markdown);
expect(platejs.error).toBeUndefined();
expect(platejs.elements).toBeDefined();
const firstElement = platejs.elements[0];
expect(firstElement.type).toBe('p');
expect(firstElement.children[0]).toEqual({
text: 'Top performers balance volume and value across purchase contexts:',
});
expect(platejs.elements).toEqual([
{
children: [
{
text: 'Top performers balance volume and value across purchase contexts:',
},
],
type: 'p',
},
{
children: [
{
bold: true,
text: 'High-volume replacement parts',
},
{
text: ' (1,088 orders, $16M revenue)',
},
],
type: 'p',
indent: 1,
listStyleType: 'disc',
},
{
children: [
{
bold: true,
text: 'High-value maintenance & upgrade',
},
{
text: ' (535 orders, $21.4M revenue)',
},
],
type: 'p',
indent: 1,
listStyleType: 'disc',
},
]);
});
}); });
describe('platejsToMarkdown', () => { describe('platejsToMarkdown', () => {