remarkjs / react-markdown
Showing 1 of 4 files from the diff.

@@ -1,6 +1,7 @@
Loading
1 1
'use strict'
2 2
3 3
const React = require('react')
4 +
const vfile = require('vfile')
4 5
const unified = require('unified')
5 6
const parse = require('remark-parse')
6 7
const remarkRehype = require('remark-rehype')
@@ -98,21 +99,24 @@
Loading
98 99
    .use(options.rehypePlugins || [])
99 100
    .use(filter, options)
100 101
101 -
  let children = options.children
102 +
  /** @type {vfile} */
103 +
  let file
102 104
103 -
  if (typeof children !== 'string') {
104 -
    if (children !== undefined && children !== null) {
105 +
  if (typeof options.children === 'string') {
106 +
    file = vfile(options.children)
107 +
  } else {
108 +
    if (options.children !== undefined && options.children !== null) {
105 109
      console.warn(
106 -
        `[react-markdown] Warning: please pass a string as \`children\` (not: \`${children}\`)`
110 +
        `[react-markdown] Warning: please pass a string as \`children\` (not: \`${options.children}\`)`
107 111
      )
108 112
    }
109 113
110 -
    children = ''
114 +
    file = vfile()
111 115
  }
112 116
113 117
  /** @type {Root} */
114 118
  // @ts-ignore we’ll throw if it isn’t a root next.
115 -
  const hastNode = processor.runSync(processor.parse(children))
119 +
  const hastNode = processor.runSync(processor.parse(file), file)
116 120
117 121
  if (hastNode.type !== 'root') {
118 122
    throw new TypeError('Expected a `root` node')
Files Coverage
src 100.00%
Project Totals (4 files) 100.00%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading