hoducha / wp-markdown-editor

Markdown Editor for Wordpress
GNU General Public License v2.0
64 stars 15 forks source link

Using with shortcodes #13

Open cezarsmpio opened 7 years ago

cezarsmpio commented 7 years ago

Hi guys, I'm trying to use shortcodes inside markdown, in a first way, it's working very well, but if I try execute this code, take a look:

### Code example

[tabs]
[tab label="curl"]
    ```language-javascript
    var a = 'foo';

[/tab] [tab label="Node.js"]

    var b = 'bar';

[/tab] [/tabs]


My result is:
<img width="404" alt="captura de tela 2016-10-14 as 10 59 02" src="https://cloud.githubusercontent.com/assets/954889/19390157/3c572f20-91fd-11e6-9861-80686d171f3b.png">

My shortcodes:

``` php
// Tabs
function tabs($attrs, $content = null) {
  return '<nav class="tab">' . do_shortcode($content) . '</nav>';
}
add_shortcode('tabs', 'tabs');

function tab($attrs, $content = null) {
  return '
    <a href="#" data-tab="#" class="tab__anchor">' . $attrs['label'] . '</a>
    <section class="tab__content">' . $content . '</section>
  ';
}
add_shortcode('tab', 'tab');