This is the code:
import remarkParse from 'remark-parse'
import rehypeSanitize from 'rehype-sanitize'
import rehypeStringify from "rehype-stringify"
import rehypeRaw from "rehype-raw"
import remarkGfm from 'remark-gfm'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {unified} from 'unified'
const markdownTable = `Here is a 200+ word response providing insights on the search query and suggested follow-up questions:
India and China are two of the world's largest producers of cement. Cement production is an important economic indicator, as the construction industry is a major driver of the economy in both countries. Tracking cement production over time can provide insights into infrastructure development, housing construction, and overall economic growth.
A table comparing India and China's cement production over the last 5 years would look something like this:
| Year | India (million tonnes) | China (million tonnes) |
|-|-|-|
| 2019 | 337 | 2,200 |
| 2018 | 322 | 2,130 |
| 2017 | 297 | 2,410 |
| 2016 | 283 | 2,350 |
| 2015 | 270 | 2,500 |
The table shows that China's cement production far exceeds India's, which is expected given the size of its economy. However, India's cement production has been steadily increasing over the past 5 years, reflecting its rapid infrastructure and housing growth. China's cement production peaked in 2014 and has slightly declined since then as its economy has matured.
### India vs China
`
const file = await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeSanitize)
.use(rehypeStringify)
.process(markdownTable)
console.log("html(remarkParse):");
console.log(String(file))
And this is the error I am getting:
Uncaught (in promise) TypeError: Cannot `process` without `Compiler`
I have already checked this not sure it solves my problem.
I was suspecting some issue with contents of markdownTable variable but no matter what text I pass I am getting the same error.
changing
unified.process()tounified.parse()resolved the issue. I am not sure how exactly it works, I got the tip from here