Check out example codes for "html to markdown". It will help you in understanding the concepts better.

Code Example 1

Kindly refer below link to convert html to markdown
https://www.browserling.com/tools/html-to-markdown

Learn ReactJs, React Native from akashmittal.com