Open BrentHuang opened 3 months ago
just like this
https://github.com/executablebooks/mdit-py-plugins https://github.com/bjoernricks/mdit-py-toc
If flet supports rendering html+css documents, let's say there is such a control as HtmlControl, then I can put the result of markdown-it-py render in this control html_content, put the TOC part of it in another control html_toc:
html_toc
<nav>
<ul>
<li>
<a href="#a-flet_docs-flet-app">A flet_docs Flet app </a>
<ul>
<li><a href="#todo">todo </a></li>
</ul>
</li>
</ul>
</nav>
html_content
<h1 id="a-flet_docs-flet-app">A flet_docs Flet app <a class="header-anchor" href="#a-flet_docs-flet-app">¶</a></h1>
<p>xxxxxxxxxxxxxxx</p>
<p>xxxxxxxxxxxxxxxxx</p>
<p>To run the app:</p>
<pre><code class="language-python">flet run --web -d -r --port 8080 [app_directory]
</code></pre>
<h2 id="todo">todo <a class="header-anchor" href="#todo">¶</a></h2>
<ol>
<li>xxxxxxxxxxxxxxxxx</li>
<li>xxxxxxxxxxxxxxxxxxxx</li>
</ol>
Click the anchor point in html_toc to trigger a jump inside html_content.
OR ft.Markdown has a method scroll_to_head, like this:
self.__ref_markdown.current.scroll_to_head('## head2-6')
If flet supports rendering html+css documents
Flet currently doesn't support it.
There's an issue for it:
It would be perfect if we could click on a TOC item and the content of the markdown document would scroll to the corresponding title!
also need search in markdown
and markdown editor.
Duplicate Check
Describe the requested feature
I extracted the toc of a markdown file and placed it on the side, each directory being a textbutton. When I click the textbutton, I want the central markdown document (flet.Markdown) to jump to the corresponding chapter.