From bc7ecf7b011226c6e2c15618110f1c55198f4842 Mon Sep 17 00:00:00 2001 From: Alexey Shmalko Date: Sun, 14 Aug 2022 17:14:56 +0300 Subject: [PATCH] feat(uniorg-rehype): add support for statistics-cookie --- .../src/__snapshots__/org-to-hast.spec.ts.snap | 6 ++++++ packages/uniorg-rehype/src/org-to-hast.spec.ts | 2 ++ packages/uniorg-rehype/src/org-to-hast.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/packages/uniorg-rehype/src/__snapshots__/org-to-hast.spec.ts.snap b/packages/uniorg-rehype/src/__snapshots__/org-to-hast.spec.ts.snap index 1c68cc7..8f5c09b 100644 --- a/packages/uniorg-rehype/src/__snapshots__/org-to-hast.spec.ts.snap +++ b/packages/uniorg-rehype/src/__snapshots__/org-to-hast.spec.ts.snap @@ -408,6 +408,12 @@ printf("%d\\n", *a); `; +exports[`org/org-to-hast statistics cookie 1`] = ` + +

hello [2/3]

+ +`; + exports[`org/org-to-hast subscript 1`] = `

hellothere

diff --git a/packages/uniorg-rehype/src/org-to-hast.spec.ts b/packages/uniorg-rehype/src/org-to-hast.spec.ts index f13da4c..b37b500 100644 --- a/packages/uniorg-rehype/src/org-to-hast.spec.ts +++ b/packages/uniorg-rehype/src/org-to-hast.spec.ts @@ -103,6 +103,8 @@ not exported text ` ); + hastTest('statistics cookie', `* hello [2/3]`); + hastTest( 'useSections', `hello diff --git a/packages/uniorg-rehype/src/org-to-hast.ts b/packages/uniorg-rehype/src/org-to-hast.ts index accaff9..1116837 100644 --- a/packages/uniorg-rehype/src/org-to-hast.ts +++ b/packages/uniorg-rehype/src/org-to-hast.ts @@ -264,6 +264,8 @@ export function orgToHast( ) as Hast[] ); } + case 'statistics-cookie': + return h(org, 'span', { className: 'statistics-cookie' }, org.value); case 'plain-list': if (org.listType === 'unordered') { return h(org, 'ul', {}, toHast(org.children));