Skip to content

Commit

Permalink
Replace: mfm - strike -> delete
Browse files Browse the repository at this point in the history
  • Loading branch information
fs5m8 committed Jan 12, 2023
1 parent 4de9dfa commit ba0c188
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/client/app/common/views/components/mfm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default Vue.component('misskey-flavored-markdown', {
return [createElement('b', genEl(token.children))];
}

case 'strike': {
case 'delete': {
return [createElement('del', genEl(token.children))];
}

Expand Down
4 changes: 2 additions & 2 deletions src/mfm/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const mfmLanguage = P.createLanguage({
r.bold,
r.small,
r.italic,
r.strike,
r.delete,
r.motion,
r.spin,
r.jump,
Expand Down Expand Up @@ -104,7 +104,7 @@ export const mfmLanguage = P.createLanguage({

return P.alt(xml, underscore).map(x => createTree('italic', r.inline.atLeast(1).tryParse(x), {}));
},
strike: r => P.regexp(/~~([^\n~]+?)~~/, 1).map(x => createTree('strike', r.inline.atLeast(1).tryParse(x), {})),
delete: r => P.regexp(/~~([^\n~]+?)~~/, 1).map(x => createTree('delete', r.inline.atLeast(1).tryParse(x), {})),
motion: r => {
const paren = P.regexp(/\(\(\(([\s\S]+?)\)\)\)/, 1);
const xml = P.regexp(/<motion>(.+?)<\/motion>/, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/mfm/to-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function toString(tokens: MfmForest | null, opts?: RestoreOptions): strin
return `<small>${appendChildren(token.children, opts)}</small>`;
},

strike(token, opts) {
delete(token, opts) {
return `~~${appendChildren(token.children, opts)}~~`;
},

Expand Down
2 changes: 1 addition & 1 deletion src/mfm/toHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function toHtml(tokens: MfmForest | null, mentionedRemoteUsers: IMentione
return el;
},

strike(token) {
delete(token) {
const el = doc.createElement('del');
appendChildren(token.children, el);
return el;
Expand Down
4 changes: 2 additions & 2 deletions test/mfm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1213,11 +1213,11 @@ describe('MFM', () => {
});
});

describe('strike', () => {
describe('delete', () => {
it('simple', () => {
const tokens = parse('~~foo~~');
assert.deepStrictEqual(tokens, [
tree('strike', [
tree('delete', [
text('foo')
], {}),
]);
Expand Down

0 comments on commit ba0c188

Please sign in to comment.