| 24 | * From next.config.js's mdxRs option, construct an actual option object that mdxRs compiler accepts. |
| 25 | */ |
| 26 | function coereceMdxTransformOptions(options = {}) { |
| 27 | const { mdxType, ...restOptions } = options |
| 28 | |
| 29 | let parse = undefined |
| 30 | switch (mdxType) { |
| 31 | case 'gfm': |
| 32 | parse = { |
| 33 | constructs: { |
| 34 | gfmAutolinkLiteral: true, |
| 35 | gfmFootnoteDefinition: true, |
| 36 | gfmLabelStartFootnote: true, |
| 37 | gfmStrikethrough: true, |
| 38 | gfmTable: true, |
| 39 | gfmTaskListItem: true, |
| 40 | }, |
| 41 | } |
| 42 | break |
| 43 | case 'commonMark': |
| 44 | default: |
| 45 | parse = { gfmStrikethroughSingleTilde: true, mathTextSingleDollar: true } |
| 46 | break |
| 47 | } |
| 48 | |
| 49 | return { |
| 50 | ...restOptions, |
| 51 | parse, |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * A webpack loader for mdx-rs. This is largely based on existing @mdx-js/loader, |