Skip to content

Commit

Permalink
fix(project): replaceAll is not a function in node14
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
skoropadas committed Mar 5, 2024
1 parent 1ae36e6 commit 444ae36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ module.exports = (markdown, unsupportedTagsStrategy) => {
.use(stringify, telegramifyOptions)
.processSync(markdown)
.toString()
.replaceAll(/<!---->\n/g, '');
.replace(/<!---->\n/gi, '');
};
7 changes: 7 additions & 0 deletions tests/convert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ describe('Test convert method', () => {
expect(convert(markdown)).toBe(tgMarkdown);
})

it(`Multiple code blocks and lists`, () => {
const markdown = `1. Foo:\n\n\`\`\`\nBar\n\`\`\`\n\n2. Baz:\n\n\`\`\`\nQux\n\`\`\``;
const tgMarkdown = `1\\. Foo:\n\n\n\`\`\`\nBar\n\`\`\`\n\n2\\. Baz:\n\n\n\`\`\`\nQux\n\`\`\`\n`;

expect(convert(markdown)).toBe(tgMarkdown);
})

describe('escape unsupported tags', () => {
it('should escape blockquote', () => {
const markdown = '> test';
Expand Down

0 comments on commit 444ae36

Please sign in to comment.