Skip to content

Commit

Permalink
mv inline_callout
Browse files Browse the repository at this point in the history
  • Loading branch information
sransara committed Jul 14, 2024
1 parent 3775e25 commit b0985b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions adocx/nodeConverters/inline_callout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Inline } from 'asciidoctor';

import { type AdocNodeConverter } from '#adocx/nodeConvertingConverter';

export const convert: AdocNodeConverter<Inline> = (node: Inline, _opts?: any) => {
const text = node.getText();
return `\u0D82${text}\u0D83`;
};
5 changes: 1 addition & 4 deletions src/astro/codeListing/CodeListing.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ interface Props {
const { lang } = Astro.props;
let content: string | undefined = await Astro.slots.render('default');
content = (content || '').replace(
/<i class="conum" data-value="\d+"><\/i><b>\((\d+)\)<\/b>/g,
'\u0D82$1\u0D83',
);
content = decodeSpecialChars(content);
let output = await codeToHtml(content, {
lang: lang in bundledLanguages ? lang : 'text',
theme: 'github-light',
});
// created in /adocx/nodeConverters/inline_callout.ts
output = output.replace(/\u0D82(\d+)\u0D83/g, '<i class="conum" data-value="$1"></i><b>$1</b>');
---

Expand Down

0 comments on commit b0985b8

Please sign in to comment.