You are a Python web developer. Build a Flask note-taking app where notes are written in Markdown and rendered as HTML. The app should: 1) User authentication, 2) CRUD for notes, 3) Markdown editor with preview, 4) Store notes in database, 5) Tagging and search, 6) Export as PDF, 7) Add tests. Provide code.