You just need to place the mermaid code in a code block (starting with 3 backticks followed by mermaid and ending with 3 backticks) like this:
```mermaid
graph TD;
A–>B;
A–>C;
B–>D;
C–>D;
```
Edit: The arrows should be like --> and you need to add a Tab before each A-->B;