mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add Markdown cell format
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
This commit is contained in:
@@ -135,7 +135,9 @@ class ParagraphRenderer extends FormRenderer {
|
||||
return css.paragraph(
|
||||
css.paragraph.cls(`-alignment-${this.layoutNode.alignment || 'left'}`),
|
||||
el => {
|
||||
el.innerHTML = sanitizeHTML(marked(this.layoutNode.text || '**Lorem** _ipsum_ dolor'));
|
||||
el.innerHTML = sanitizeHTML(marked(this.layoutNode.text || '**Lorem** _ipsum_ dolor', {
|
||||
async: false,
|
||||
}));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ export const cssMarkdownRender = styled('div', `
|
||||
export function markdown(obs: BindableValue<string>, ...args: IDomArgs<HTMLDivElement>) {
|
||||
return cssMarkdownRender(el => {
|
||||
dom.autoDisposeElem(el, subscribeBindable(obs, val => {
|
||||
el.innerHTML = sanitizeHTML(marked(val));
|
||||
el.innerHTML = sanitizeHTML(marked(val, {async: false}));
|
||||
}));
|
||||
}, ...args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user