mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 06:53:10 +02:00
[MFM] Add <i> syntax
This commit is contained in:
parent
ff4cb3555b
commit
f8ba73bebf
2 changed files with 10 additions and 1 deletions
|
@ -224,7 +224,7 @@ const mfm = P.createLanguage({
|
||||||
|
|
||||||
//#region Italic
|
//#region Italic
|
||||||
italic: r =>
|
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(
|
.map(x => createTree('italic', P.alt(
|
||||||
r.bold,
|
r.bold,
|
||||||
r.strike,
|
r.strike,
|
||||||
|
|
|
@ -883,6 +883,15 @@ describe('MFM', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('italic', () => {
|
describe('italic', () => {
|
||||||
|
it('<i>', () => {
|
||||||
|
const tokens = analyze('<i>foo</i>');
|
||||||
|
assert.deepStrictEqual(tokens, [
|
||||||
|
tree('italic', [
|
||||||
|
text('foo')
|
||||||
|
], {}),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('underscore', () => {
|
it('underscore', () => {
|
||||||
const tokens = analyze('_foo_');
|
const tokens = analyze('_foo_');
|
||||||
assert.deepStrictEqual(tokens, [
|
assert.deepStrictEqual(tokens, [
|
||||||
|
|
Loading…
Reference in a new issue