SSWConsulting / SSW.Rules

Generator for ssw.com.au/rules
https://www.ssw.com.au/rules
MIT License
13 stars 13 forks source link

Markdown Components - Migrate to MDX #1470

Open bradystroud opened 1 month ago

bradystroud commented 1 month ago

Blocked by #1523

All these components will need to

  1. become JSX components
  2. Added to Tina
  3. Fixed in the content via a script
isaaclombardssw commented 2 weeks ago

Caleb and I accidentally looked into this in a lot of detail within the scope of #1465.

  1. For the body field, that's defined in the schema for the rule collection, it should be extracted into an external JSON file.

  2. Prior to to the markdown being passed into the function (parseMDX) which we're using the generate the AST tree, use regex to transform the markdown syntax into something Tina will eat.

ex.

      ::: greybox

      ### our text

      our text

      :::

to either....

      <greybox
        content={<>
          ### our text

          our text
        </>}
      >

OR

      <greybox>
        ### our text

        our text
      </greybox>
  1. When calling parseMDX, you need to pass in the JSON field as the second param (this tries to match the data in the md file with the structure of the rule).
isaaclombardssw commented 2 weeks ago

/::: greybox([\s\S]*?):::/;