Just to quick summarise, most of us don’t use markdown directly when writing, but use Styles and Section Types that are a core part of Scrivener’s writing environment. The magic happens in the compiler, where Scrivener translates these Scrivener features to text markup, then the post-processor does its magic to do whatever you want. You are not limited to PDFs either, keeping output flexible. It can be a bit overwhelming when trying to come up with a workflow…
For PDF output you have a large number of engines available: Pandoc - Pandoc User’s Guide — the standard is LaTeX, but my current crush is Typst (accepting this is still a young project at V0.11 and will change as features stabilise), and if I wrote fiction I would also contemplate PrinceXML.