Adding table captions using PHP Markdown Extra

GRAV Forum,

Is there a supported way to add captions to tables in PHP Markdown Extra? I read through the documentation and didn’t see a way.

Are there other available work arounds?

Regards,

Sean

@jerobapatrol, I’m not sure if there is a “supported” way.

Wrapping the table in a <figure> tag might do the trick:

  • Install plugin ‘Shortode Core’
  • In Markdown use:
    [figure caption="**Fig. 1** A beautiful figure."]
    
    | Tables        | Are           | Cool  |
    | ------------- |:-------------:| -----:|
    | col 3 is      | right-aligned | $1600 |
    | col 2 is      | centered      |   $12 |
    | zebra stripes | are neat      |    $1 |
    
    [/figure]
    
  • Add css:
    figure {
      display: inline-block;
    }
    figcaption {
      text-align: center;
    }
    
  • Result
    Untitled
1 Like

Thank you @pamtbaau. This is exactly what I’m looking for. I already use ‘Shortcode Core’ for icons and notices.

I typically start with CommonMark markdown files and convert them to PHP Extra using Pandoc. Hopefully I can figure out a programmatic way to covert table captions to this figure environment.