gristlabs_grist-core/app/client/ui/DocTutorialRenderer.ts
George Gevoian be8e13df64 (core) Add initial tutorials implementation
Summary:
Documents can now be flagged as tutorials, which causes them to display
Markdown-formatted slides from a special GristDocTutorial table. Tutorial
documents are forked on open, and remember the last slide a user was on.
They can be restarted too, which prepares a new fork of the tutorial.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3813
2023-03-22 10:09:02 -04:00

17 lines
495 B
TypeScript

import {marked} from 'marked';
export const renderer = new marked.Renderer();
renderer.image = (href: string, text: string) => {
return `<div class="doc-tutorial-popup-thumbnail">
<img src="${href}" title="${text ?? ''}" />
<div class="doc-tutorial-popup-thumbnail-icon-wrapper">
<div class="doc-tutorial-popup-thumbnail-icon"></div>
</div>
</div>`;
};
renderer.link = (href: string, _title: string, text: string) => {
return `<a href="${href}" target="_blank">${text}</a>`;
};