We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Creating a Navigation Table of Contents for Phoenix Blogs with MDEx
264
clicks
Source: farens.me
In this article, the author explains how to develop a Table of Contents (TOC) component for a Phoenix blog using the MDEx markdown parser. The goal is to allow users to quickly navigate through content sections by creating links to each heading. The article begins with configuring MDEx to include IDs and anchor links for headings in the generated HTML. It then explains how to parse the headings using the Floki library and convert them into a suitable data structure. Finally, the author walks through building the TOC component itself and demonstrates how to incorporate it into a Phoenix project layout, emphasizing the use of CSS classes from daisyUI for styling.
Related posts
© HashMerge 2024