Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
vagusX committed Apr 15, 2024
1 parent 2cb0fa8 commit 12a7686
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/visual-regression/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ interface IImageDesc {

function getMdImageTag(desc: IImageDesc, extraCaption?: boolean) {
const { src, alt } = desc;
if (!extraCaption) {
if (!extraCaption || !alt) {
// in md2html report, we use `@microflash/rehype-figure` to generate a figure
return `![${alt}](${src})`;
}
// show caption with image in github markdown comment
return `![${alt}](${src})\n**${alt}**`;
return `![${alt}](${src}) ${alt}`;
}

interface IBadCase {
Expand Down
2 changes: 1 addition & 1 deletion scripts/visual-regression/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { remark } from 'remark';
import remarkGfm from 'remark-gfm';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
const rehypeFigure = require('@microflash/rehype-figure');
import rehypeFigure from '@microflash/rehype-figure';

export default function markdown2Html(content: string) {
return remark()
Expand Down
2 changes: 2 additions & 0 deletions typings/custom-typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ declare module '@npmcli/run-script' {
[key: string]: string | string[] | boolean | NodeJS.ProcessEnv;
}): Promise<void>;
}

declare module '@microflash/rehype-figure';

0 comments on commit 12a7686

Please sign in to comment.