mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-13 14:22:25 +03:00
Merge 3f4c078bf2
into 31c6d13fdf
This commit is contained in:
commit
c3e0a48b64
1 changed files with 8 additions and 8 deletions
|
@ -11,13 +11,13 @@ export const HeadingRule: BlockMDRule = {
|
|||
};
|
||||
|
||||
const CODEBLOCK_MD_1 = '```';
|
||||
const CODEBLOCK_REG_1 = /^`{3}(\S*)\n((?:.*\n)+?)`{3} *(?!.)\n?/m;
|
||||
const CODEBLOCK_REG_1 = /^(`{3,}|~{3,})(?:[ \t]*(\S+))?\n([\s\S]*?)\1 *(?!.)\n?/m;
|
||||
export const CodeBlockRule: BlockMDRule = {
|
||||
match: (text) => text.match(CODEBLOCK_REG_1),
|
||||
html: (match) => {
|
||||
const [, g1, g2] = match;
|
||||
const classNameAtt = g1 ? ` class="language-${g1}"` : '';
|
||||
return `<pre data-md="${CODEBLOCK_MD_1}"><code${classNameAtt}>${g2}</code></pre>`;
|
||||
const [ , fence, lang, code ] = match;
|
||||
const classNameAtt = lang ? ` class="language-${lang}"` : '';
|
||||
return `<pre data-md="${fence}"><code${classNameAtt}>${code}</code></pre>`;
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -44,11 +44,11 @@ export const BlockQuoteRule: BlockMDRule = {
|
|||
};
|
||||
|
||||
const ORDERED_LIST_MD_1 = '-';
|
||||
const O_LIST_ITEM_PREFIX = /^(-|[\da-zA-Z]\.) */;
|
||||
const O_LIST_ITEM_PREFIX = /^([\da-zA-Z]\.) */;
|
||||
const O_LIST_START = /^([\d])\./;
|
||||
const O_LIST_TYPE = /^([aAiI])\./;
|
||||
const O_LIST_TRAILING_NEWLINE = /\n$/;
|
||||
const ORDERED_LIST_REG_1 = /(^(?:-|[\da-zA-Z]\.) +.+\n?)+/m;
|
||||
const ORDERED_LIST_REG_1 = /(^(?:[\da-zA-Z]\.) +.+\n?)+/m;
|
||||
export const OrderedListRule: BlockMDRule = {
|
||||
match: (text) => text.match(ORDERED_LIST_REG_1),
|
||||
html: (match, parseInline) => {
|
||||
|
@ -74,9 +74,9 @@ export const OrderedListRule: BlockMDRule = {
|
|||
};
|
||||
|
||||
const UNORDERED_LIST_MD_1 = '*';
|
||||
const U_LIST_ITEM_PREFIX = /^\* */;
|
||||
const U_LIST_ITEM_PREFIX = /^([-*+]) */;
|
||||
const U_LIST_TRAILING_NEWLINE = /\n$/;
|
||||
const UNORDERED_LIST_REG_1 = /(^\* +.+\n?)+/m;
|
||||
const UNORDERED_LIST_REG_1 = /(^([-*+]) +.+\n?)+/m;
|
||||
export const UnorderedListRule: BlockMDRule = {
|
||||
match: (text) => text.match(UNORDERED_LIST_REG_1),
|
||||
html: (match, parseInline) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue