mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
[MFM] Add <i> syntax
This commit is contained in:
parent
32ef3e9fbd
commit
9d93e1d659
@ -224,7 +224,7 @@ const mfm = P.createLanguage({
|
||||
|
||||
//#region Italic
|
||||
italic: r =>
|
||||
P.regexp(/(\*|_)([a-zA-Z0-9]+?[\s\S]*?)\1/, 2)
|
||||
P.alt(P.regexp(/<i>([\s\S]+?)<\/i>/, 1), P.regexp(/(\*|_)([a-zA-Z0-9]+?[\s\S]*?)\1/, 2))
|
||||
.map(x => createTree('italic', P.alt(
|
||||
r.bold,
|
||||
r.strike,
|
||||
|
@ -883,6 +883,15 @@ describe('MFM', () => {
|
||||
});
|
||||
|
||||
describe('italic', () => {
|
||||
it('<i>', () => {
|
||||
const tokens = analyze('<i>foo</i>');
|
||||
assert.deepStrictEqual(tokens, [
|
||||
tree('italic', [
|
||||
text('foo')
|
||||
], {}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('underscore', () => {
|
||||
const tokens = analyze('_foo_');
|
||||
assert.deepStrictEqual(tokens, [
|
||||
|
Loading…
Reference in New Issue
Block a user