mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
292c894b93
Summary: Text columns can now display their values as Markdown-formatted text by changing their cell format to "Markdown". A minimal subset of the Markdown specification is currently supported. Test Plan: Browser tests. Reviewers: Spoffy, dsagal Reviewed By: Spoffy, dsagal Subscribers: dsagal, Spoffy Differential Revision: https://phab.getgrist.com/D4326
23 lines
635 B
TypeScript
23 lines
635 B
TypeScript
import {marked} from 'marked';
|
|
|
|
export const renderer = new marked.Renderer();
|
|
|
|
renderer.image = ({href, title}) => {
|
|
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 ?? ''}" />
|
|
<div class="doc-tutorial-popup-thumbnail-icon-wrapper">
|
|
<div class="doc-tutorial-popup-thumbnail-icon"></div>
|
|
</div>
|
|
</div>`;
|
|
};
|
|
|
|
renderer.link = ({href, text}) => {
|
|
return `<a href="${href}" target="_blank">${text}</a>`;
|
|
};
|