Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
3ac3a45a
Unverified
Commit
3ac3a45a
authored
4 years ago
by
MeiMei
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
nyaizeが適用されるとMFMのオプションが失われるのを修正 Fix #6370 (#6371)
parent
36fcc0d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mfm/to-string.ts
+3
-1
3 additions, 1 deletion
src/mfm/to-string.ts
test/mfm.ts
+70
-0
70 additions, 0 deletions
test/mfm.ts
with
73 additions
and
1 deletion
src/mfm/to-string.ts
+
3
−
1
View file @
3ac3a45a
...
...
@@ -39,7 +39,9 @@ export function toString(tokens: MfmForest | null, opts?: RestoreOptions): strin
},
spin
(
token
,
opts
)
{
return
`<spin>
${
appendChildren
(
token
.
children
,
opts
)}
</spin>`
;
const
attr
=
token
.
node
.
props
?.
attr
;
const
post
=
attr
?
`
${
attr
}
`
:
''
;
return
`<spin
${
post
}
>
${
appendChildren
(
token
.
children
,
opts
)}
</spin>`
;
},
jump
(
token
,
opts
)
{
...
...
This diff is collapsed.
Click to expand it.
test/mfm.ts
+
70
−
0
View file @
3ac3a45a
...
...
@@ -12,6 +12,7 @@ import * as assert from 'assert';
import
{
parse
,
parsePlain
}
from
'
../src/mfm/parse
'
;
import
{
toHtml
}
from
'
../src/mfm/to-html
'
;
import
{
toString
}
from
'
../src/mfm/to-string
'
;
import
{
createTree
as
tree
,
createLeaf
as
leaf
,
MfmTree
}
from
'
../src/mfm/prelude
'
;
import
{
removeOrphanedBrackets
}
from
'
../src/mfm/language
'
;
...
...
@@ -1295,4 +1296,73 @@ describe('MFM', () => {
leaf
(
'
blockCode
'
,
{
code
:
'
after
'
,
lang
:
null
})
]);
});
describe
(
'
toString
'
,
()
=>
{
it
(
'
太字
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
**太字**
'
)),
'
**太字**
'
);
});
it
(
'
中央揃え
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<center>中央揃え</center>
'
)),
'
<center>中央揃え</center>
'
);
});
it
(
'
打ち消し線
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
~~打ち消し線~~
'
)),
'
~~打ち消し線~~
'
);
});
it
(
'
小さい字
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<small>小さい字</small>
'
)),
'
<small>小さい字</small>
'
);
});
it
(
'
モーション
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<motion>モーション</motion>
'
)),
'
<motion>モーション</motion>
'
);
});
it
(
'
モーション2
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
(((モーション)))
'
)),
'
<motion>モーション</motion>
'
);
});
it
(
'
ビッグ+
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
*** ビッグ+ ***
'
)),
'
*** ビッグ+ ***
'
);
});
it
(
'
回転
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<spin>回転</spin>
'
)),
'
<spin>回転</spin>
'
);
});
it
(
'
右回転
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<spin right>右回転</spin>
'
)),
'
<spin right>右回転</spin>
'
);
});
it
(
'
左回転
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<spin left>左回転</spin>
'
)),
'
<spin left>左回転</spin>
'
);
});
it
(
'
往復回転
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<spin alternate>往復回転</spin>
'
)),
'
<spin alternate>往復回転</spin>
'
);
});
it
(
'
ジャンプ
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
<jump>ジャンプ</jump>
'
)),
'
<jump>ジャンプ</jump>
'
);
});
it
(
'
コードブロック
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
```
\n
コードブロック
\n
```
'
)),
'
```
\n
コードブロック
\n
```
'
);
});
it
(
'
インラインコード
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
`インラインコード`
'
)),
'
`インラインコード`
'
);
});
it
(
'
引用行
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
>引用行
'
)),
'
>引用行
'
);
});
it
(
'
検索
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
検索 [search]
'
)),
'
検索 [search]
'
);
});
it
(
'
リンク
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
[リンク](http://example.com)
'
)),
'
[リンク](http://example.com)
'
);
});
it
(
'
詳細なしリンク
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
?[詳細なしリンク](http://example.com)
'
)),
'
?[詳細なしリンク](http://example.com)
'
);
});
it
(
'
【タイトル】
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
【タイトル】
'
)),
'
[タイトル]
'
);
});
it
(
'
[タイトル]
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
[タイトル]
'
)),
'
[タイトル]
'
);
});
it
(
'
インライン数式
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
\\
(インライン数式
\\
)
'
)),
'
\\
(インライン数式
\\
)
'
);
});
it
(
'
ブロック数式
'
,
()
=>
{
assert
.
deepStrictEqual
(
toString
(
parse
(
'
\\\
[
\n
ブロック数式
\n\
]
\\
'
)),
'
\\\
[
\n
ブロック数式
\n\
]
\\
'
);
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment