2023-03-22 13:48:50 +00:00
|
|
|
import {marked} from 'marked';
|
|
|
|
|
|
|
|
export const renderer = new marked.Renderer();
|
|
|
|
|
2023-04-18 02:23:12 +00:00
|
|
|
renderer.image = (href: string | null, title: string | null, _text: string) => {
|
|
|
|
let classes = 'doc-tutorial-popup-thumbnail';
|
|
|
|
const hash = href?.split('#')?.[1];
|
|
|
|
if (hash) {
|
|
|
|
const extraClass = `doc-tutorial-popup-thumbnail-${hash}`;
|
|
|
|
classes += ` ${extraClass}`;
|
|
|
|
}
|
|
|
|
return `<div class="${classes}">
|
|
|
|
<img src="${href}" title="${title ?? ''}" />
|
2023-03-22 13:48:50 +00:00
|
|
|
<div class="doc-tutorial-popup-thumbnail-icon-wrapper">
|
|
|
|
<div class="doc-tutorial-popup-thumbnail-icon"></div>
|
|
|
|
</div>
|
|
|
|
</div>`;
|
|
|
|
};
|
|
|
|
|
2023-04-18 02:23:12 +00:00
|
|
|
renderer.link = (href: string | null, _title: string | null, text: string) => {
|
2023-03-22 13:48:50 +00:00
|
|
|
return `<a href="${href}" target="_blank">${text}</a>`;
|
|
|
|
};
|