'Markdown Double Table issue

I wrote a one javascript markdown editor. When I click twice the table, 2 tables are create. But I have some problem for that. That tables are merging. How to avoid this problem?

Input:

| A header | Another header |
| -------- | -------------- |
| First    | row            |
| Second   | row            |
| A header | Another header |
| -------- | -------------- |
| First    | row            |
| Second   | row            |

Output:

A header Another header
First row
Second row
A header Another header
-------- --------------
First row
Second row


Solution 1:[1]

Just add a blank line to separate them:

| A header | Another header |
| -------- | -------------- |
| First    | row            |
| Second   | row            |

| A header | Another header |
| -------- | -------------- |
| First    | row            |
| Second   | row            |

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris