Skip to content

Commit

Permalink
Fix extra new line being added before inline code
Browse files Browse the repository at this point in the history
  • Loading branch information
synzen committed Jan 13, 2024
1 parent 2d862c8 commit 86b2a61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,15 @@ describe("ArticleFormatterService", () => {

expect(result.value).toEqual("`hello world`");
});

it("does not add new line before starting tag", async () => {
const value = `<p>First <code>Before</code>:</p>`;
service = new ArticleFormatterService();

const result = service.formatValueForDiscord(value);

expect(result.value).toEqual("First `Before`:");
});
});

describe("pre", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,10 @@ export class ArticleFormatterService {
builder.addInline(`(${href})`);
}
},
inlineCode: (elem, walk, builder, options) => {
builder.openBlock(options);
builder.addInline("`");
inlineCode: (elem, walk, builder) => {
builder.addLiteral("`");
walk(elem.children, builder);
builder.addInline("`");
builder.closeBlock(options);
builder.addLiteral("`");
},
blockCode: (elem, walk, builder, options) => {
builder.openBlock(options);
Expand Down

0 comments on commit 86b2a61

Please sign in to comment.