Hi all, I have a problem with `MarkdownRenderer` w...
# flyte-support
s
Hi all, I have a problem with
MarkdownRenderer
which seem to only parse Markdown partially. Deck content start with Header 1 (
#
) and then all the rest is displayed as a Header 1 despite newlines or new headers being introduced. Also it does not recognize other syntax (I copied exactly the same content into GitHub and it works fine). Any idea?
My usage of renderer is as simple as:
Deck("page content", MarkdownRenderer().to_html(generated_content))
g
is generated_content a string?
s
yes
g
I try this, it works for me
Copy code
@task(enable_deck=True, container_image=imageSpec)
def foo() -> str:
    Deck("source code", MarkdownRenderer().to_html("## Hello World"))
    return "foo"
s
sample content:
Copy code
# Evaluating Second Derivatives in Implicit Equations  <br>  <br>## Introduction  <br>  <br>In advanced differentiation, we often encounter implicit equations where the dependent and independent variables are not explicitly defined.
g
let me try it
thanks
s
thanks, let me know if it works
g
replacing <br> with \n work for me
Copy code
from flytekit import workflow, task, Deck, ImageSpec
from flytekitplugins.deck import MarkdownRenderer

imageSpec = ImageSpec(registry="pingsutw", packages=["flytekitplugins-deck-standard"])


@task(enable_deck=True, container_image=imageSpec)
def foo() -> str:
    Deck("source code", MarkdownRenderer().to_html("# Evaluating Second Derivatives in Implicit Equations  \n  \n## Introduction  \n  \nIn advanced differentiation, we often encounter implicit equations where the dependent and independent variables are not explicitly defined. "))
    return "foo"


@workflow
def wf():
    foo()


if __name__ == '__main__':
    foo()
looks like markdown package doesn’t support <br>
s
yeah, I did exactly the same now and seems to work
👍 1
thanks
g
would you mind creating a PR for this? we can replace <br> with \n in the markdown renderer
s
meanwhile:
g
hmm? could you share your generated_content
or try the example above^^^
s
so the thing is
Copy code
<http://logger.info|logger.info>(f"Generated content: {generated_content}")

# this is value of generated_content which I copied from logs
# when pasted explicitly - works, when I comment line below and use value directly from generated_content - does not work
generated_content = "# Evaluating Second Derivatives in Implicit Equations\n\n## Introduction\nIn calculus, the second derivative of a function provides important information about the behavior of a function. It helps determine whether the function is concave up or concave down, as well as the location of inflection points. While evaluating second derivatives for explicit functions is relatively straightforward, it becomes more challenging when dealing with implicit equations where the derivative is not given explicitly. In this lesson, we will learn how to evaluate second derivatives in implicit equations.\n\n## Implicit Differentiation\nImplicit differentiation is a technique used to find"

Deck("page content", MarkdownRenderer().to_html(generated_content))
I didn't change anything, I just copied the content from logs (
<http://logger.info|logger.info>
above) and then it works, otherwise it does not 😄
Ok, @glamorous-carpet-83516 I fixed it, partially, the workaround is wild:
Copy code
generated_content = generated_content.replace('\\n', '<br>').replace('<br>', '\n')
👍 2