Skip to content

Commit

Permalink
Allow images within links in notebooks (#1442)
Browse files Browse the repository at this point in the history
Pull requests #1398 (using pure markdown for colab links) and #1394 (no nested
formatting in notebooks) merged at about the same time, but they conflicted. The
syntax used in #1398 failed the check of #1394, and indeed revealed a missing
piece: it's ok to have a link that contains an image in notebook markdown,
because this passes through the reStructuredText conversion ok.

(This was yet more "merge skew".)

This also has to replace an instance of ***bold-italic*** with plain **bold** in
the GCN-LSTM notebook, because the CI requires that this doesn't appear (as it
doesn't render correctly on Read the Docs; #1394 discusses this in more detail).
  • Loading branch information
huonw authored May 3, 2020
1 parent 9506f93 commit 49dd2cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demos/spatio-temporal/gcn-lstm-LA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"* [https://github.com/lehaifeng/T-GCN](https://github.com/lehaifeng/T-GCN)\n",
"* [Semi-Supervised Classification with Graph Convolutional Networks](http://arxiv.org/abs/1609.02907)\n",
"\n",
"***Note: this method is applicable for uni-variate timeseries forecasting.***"
"**Note: this method is applicable for uni-variate timeseries forecasting.**"
]
},
{
Expand Down
10 changes: 8 additions & 2 deletions scripts/notebook_text_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def is_text(elem):
return elem.t == "text"


def is_image(elem):
return elem.t == "image"


SYNTAX_SUMMARY = {
"block_quote": "> text",
"code": "`code`",
Expand Down Expand Up @@ -348,8 +352,10 @@ def simple_inline_formatting(cells):
# not an inline formatting, so not relevant
continue

if all(is_text(child) for child in direct_children(elem)):
# if all of the children are plain text, this is perfect!
if all(
is_text(child) or is_image(child) for child in direct_children(elem)
):
# if all of the children are plain text or images, this is perfect!
continue

# an inline element that contains non-text elements, error!
Expand Down

0 comments on commit 49dd2cb

Please sign in to comment.