Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 1x 1x 1x 11x 11x 11x 11x 11x | import { createFormatContainer } from 'roosterjs-content-model-dom';
import { createParagraphFromMarkdown } from './createParagraphFromMarkdown';
import type {
ContentModelFormatContainer,
ContentModelFormatContainerFormat,
} from 'roosterjs-content-model-types';
import type { MarkdownToModelOptions } from '../types/MarkdownToModelOptions';
const QuoteFormat: ContentModelFormatContainerFormat = {
borderLeft: '3px solid rgb(200, 200, 200)',
textColor: 'rgb(102, 102, 102)',
marginTop: '1em',
marginBottom: '1em',
marginLeft: '40px',
marginRight: '40px',
paddingLeft: '10px',
};
/**
* @internal
*/
export function createBlockQuoteFromMarkdown(
text: string,
options: MarkdownToModelOptions,
blockquote?: ContentModelFormatContainer
): ContentModelFormatContainer {
text = text.replace('>', '');
const paragraph = createParagraphFromMarkdown(text, options);
const quote =
blockquote ||
createFormatContainer(
'blockquote',
options.direction ? { ...QuoteFormat, direction: options.direction } : QuoteFormat
);
quote.blocks.push(paragraph);
return quote;
}
|