Skip to content

Commit

Permalink
feat(uniorg-rehype): add support for statistics-cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
rasendubi committed Aug 14, 2022
1 parent 6dfb8cb commit bc7ecf7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ printf("%d\\n", *a);
`;
exports[`org/org-to-hast statistics cookie 1`] = `
<h1>hello <span class="statistics-cookie">[2/3]</span></h1>
`;
exports[`org/org-to-hast subscript 1`] = `
<p>hello<sub>there</sub></p>
Expand Down
2 changes: 2 additions & 0 deletions packages/uniorg-rehype/src/org-to-hast.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ not exported text
`
);

hastTest('statistics cookie', `* hello [2/3]`);

hastTest(
'useSections',
`hello
Expand Down
2 changes: 2 additions & 0 deletions packages/uniorg-rehype/src/org-to-hast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit bc7ecf7

Please sign in to comment.