From 0a70e2ee284c1fbca2efb169be77de8634451506 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 22 Nov 2023 15:24:48 +0300 Subject: [PATCH] fix: use hr instead of a tag --- src/transform/plugins/block-anchor/block-anchor.ts | 2 +- test/block-anchor.test.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/transform/plugins/block-anchor/block-anchor.ts b/src/transform/plugins/block-anchor/block-anchor.ts index db2e09aa..4b8fdab9 100644 --- a/src/transform/plugins/block-anchor/block-anchor.ts +++ b/src/transform/plugins/block-anchor/block-anchor.ts @@ -45,5 +45,5 @@ export function replaceTokens(state: StateCore) { export function renderTokens(tokens: Token[], idx: number) { const token = tokens[idx]; const id = token.content; - return ``; + return `
`; } diff --git a/test/block-anchor.test.ts b/test/block-anchor.test.ts index e3b189c4..76c0ca9e 100644 --- a/test/block-anchor.test.ts +++ b/test/block-anchor.test.ts @@ -13,14 +13,16 @@ let transformYfm = (text: string) => { describe('block-anchor', function () { describe('simple rendering', () => { - it('should render an a tag', () => { - expect(transformYfm('{%anchor my-anchor%}')).toBe(''); + it('should render an hr tag', () => { + expect(transformYfm('{%anchor my-anchor%}')).toBe( + '
', + ); }); it('does not consume things it should not', () => { expect(transformYfm('# Heading \n {%anchor my-anchor%} \n # Other heading')).toEqual( '

Heading

\n' + - '

' + + '

' + 'Other heading

\n', ); @@ -44,7 +46,7 @@ describe('block-anchor', function () { '

' + 'Heading

\n' + - '', + '
', ); }); });