Skip to content

Commit

Permalink
prevent undefined from getting printed in markdown text (#1379)
Browse files Browse the repository at this point in the history
* prevents undefined from getting printed in markdown

* fix all tests
  • Loading branch information
harshdoesdev authored Oct 12, 2023
1 parent 510d07c commit bf7f72b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
4 changes: 3 additions & 1 deletion fastn-js/js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,9 @@ class Node2 {
staticValue = this.#node.innerHTML;
}
staticValue = fastn_utils.process_post_markdown(this.#node, staticValue);
this.#node.innerHTML = staticValue;
if(!fastn_utils.isNull(staticValue)) {
this.#node.innerHTML = staticValue;
}
} else {
throw ("invalid fastn_dom.PropertyKind: " + kind);
}
Expand Down
13 changes: 13 additions & 0 deletions ftd/t/js/21-markdown.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@
# Marked in the browser

Rendered by **marked**.

-- component markdown:
body string text:

-- ftd.text:
text: $markdown.text

-- end: markdown

-- markdown:

;; COMMENT NEXT LINE
;; Go to the [new page](/new-page/).
19 changes: 18 additions & 1 deletion ftd/t/js/21-markdown.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/63-external-js.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf7f72b

Please sign in to comment.