flet icon indicating copy to clipboard operation
flet copied to clipboard

Markdown broken when an image is not found when using flet -d

Open Petrox opened this issue 2 years ago • 1 comments

I searched for duplicate issue, didn't found.

Mentioned the problem on discord, no response.

Description

Markdown often breaks silently on images and produces a huge grey zone without content when run by flet -d

Code example to reproduce the issue:

Go to: https://flet.dev/docs/controls/markdown/ Copy the whole example to mdtest.py

Run with flet -d mdtest.py

import flet as ft

md1 = """
![Image from Flet assets](/icons/icon-192.png)
"""

def main(page: ft.Page):
    page.scroll = "auto"
    page.add(
        ft.Markdown(
            md1,
            selectable=True,
            extension_set=ft.MarkdownExtensionSet.GITHUB_WEB,
            on_tap_link=lambda e: page.launch_url(e.data),
        )
    )

ft.app(target=main)

Describe the results you received: Empty dialog with a vertically scrollable grey zone:

kép

Note: the example does not contain the icon assets.

Describe the results you expected:

The example from the docs: custom-markdown

Additional information you deem important (e.g. issue happens only occasionally): It works mostly when I run the program directly and I use the web browser.

Flet version (pip show flet):

$ pip show flet Name: flet Version: 0.13.0

Operating system:

Windows 10

Additional environment details: Python 3.12

Petrox avatar Nov 29 '23 19:11 Petrox

I encountered this as well for flet app mode. Works fine in flet web mode. -- flet fails to render all markdown in the Markdown object if there is a broken local image link.

brycepg avatar Jun 27 '24 18:06 brycepg