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
2 Likes

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.

I know its been a while, but how did you get the CSS in? I tried using this, and nothing showed up. I tried putting the css in the custom.css with the theme, and direclty inline. No luck.

@symgryph, Not sure if your issue is related to the original questions “Adding table captions…”, or just a question solely about adding css to a theme…

If it is the latter, then please create a new post with a proper title describing your issue.