MCPcopy
hub / github.com/vercel/next.js / coereceMdxTransformOptions

Function coereceMdxTransformOptions

packages/next-mdx/mdx-rs-loader.js:26–53  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

24 * From next.config.js's mdxRs option, construct an actual option object that mdxRs compiler accepts.
25 */
26function 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,

Callers 1

loaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected