Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit d74c2e3

Browse files
neil molinaneil molina
authored andcommitted
prevent readme breaking on rst readme's
1 parent 1d282ac commit d74c2e3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

modules/ui/src/markdown/rst2html.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// sorry no time to make a pr to the module there
33
// added a render_directive fn
44
import restructured from "restructured";
5+
import _ from "lodash";
56

67
type Element = {
78
type: string;
@@ -188,8 +189,8 @@ const render_block_element = (
188189

189190
const render_directive = (element: Element, level = 0, indent = 2): string => {
190191
const indentString = " ".repeat(level * indent);
191-
const src = element.children[0].value;
192-
const alt = element.children[1].value;
192+
const src = _.get(element, "children[0].children[0].value", "");
193+
const alt = _.get(element, "children[1].children[1].value", "");
193194
return element.directive === "image"
194195
? `
195196
${indentString}<img src="${src}" alt="${alt}" />\n

0 commit comments

Comments
 (0)