Why Markdown?
What is the advantage of using a markdown wysiwyg editor over an editor that just outputs HTML?
Because there are cases where you can't use a WYSIWYG editor, and should revert to text mode.
Example: diff
of a question or an answer on Stack Exchange. Sometimes, you can simply compare the rendered layout. But there are cases where the rendered layout is not explicit enough, and watching Markdown helps in understanding what was changed.
Because Markdown is more compact. Storing HTML instead of Markdown would take more place in the database.
This is a lame argument, given the price per GB today. Besides, in most cases, HTML is stored side by side with Markdown in the database in order to generate the HTML once, and regenerate it only when Markdown is changed.
Because if the post was originally written in Markdown, you should keep it if you want to show it later to the author. If you convert everything to HTML and try to reconstitute Markdown from HTML later, there are chances the Markdown would not correspond to the original one.
A basic example: for titles in my answers on Stack Exchange, I put two dashes like this:
This is a title in Markdown
--
Other persons would prefer:
This is a title in Markdown
---------------------------
Others would rather write:
## This is a title in Markdown
When I work in vim, I use the third format, because it feels more natural. But not on Stack Exchange.
Those three variants produce the same HTML. By recreating Markdown from HTML, you'll pick one of those three formats, and annoy people who are using two other variants.
Why a WYSIWYG editor for Markdown?
What I don't understand, is the advantages of using a wysiwyg editor for markdown in web applications
You work in IT. You understand Markdown and are willing to learn it. Right.
My grand-mother never worked in IT. She is willing to click on the bold "B" icon to make the text bold, or on the nice landscape in a frame to insert an image. But inserting dashes and stars? I don't think so. Probably, she doesn't even know there is "#" key on the keyboard.
I hate PHPBB. There are many reasons for that, but one minor reason is the fact that I need to type [b][/b] just to insert some bold text. That's just crazy. On a French keyboard, it requires some effort. Currently, I'm typing with a Belgian keyboard, and it took me 30 seconds just to find "[" and "]" keys.
Markdown is easier, but still, persons who are habituated to a different format and who don't care about Markdown either:
Having a WYSIWYG editor helps those people to avoid thinking about the characters they need to type, and focus on the intention, i.e. how do they need to format the piece of text.