Comments (1)
import { unified } from 'unified'
import rehypeRaw from 'rehype-raw'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
import rehypePrettyCode from 'rehype-pretty-code'
import { inspect } from 'unist-util-inspect'
const text = `
<img src="https://example.com/image.png" alt="Example image" />
\`\`\`js {1}
import React from 'react'
\`\`\`
`
const file = await unified()
.use(remarkParse)
.use(remarkRehype, { allowDangerousHtml: true })
.use(() => tree => console.log('before rehypeRaw', inspect(tree), '\n'))
.use(rehypeRaw)
.use(() => tree => console.log('after rehypeRaw', inspect(tree), '\n'))
.use(rehypePrettyCode)
.use(rehypeStringify)
.process(text)
console.log(file.toString())
from velite.
Related Issues (20)
- How to pass in props to the built mdx code? HOT 2
- Virtual Collection Request HOT 7
- Error on top level array for JSON/YAML HOT 2
- Suggestion: Generate json schemas for json/yaml files HOT 1
- type inference doesn't work when using defineCollection HOT 1
- How to reference MDX images from the public folder without copying them to the public directory during the build. HOT 2
- The deployment on Vercel failed, it seems to be a bug? HOT 38
- Property 'content' does not exist on type 'ZodMeta'. HOT 3
- Flattened path is not correctly handled for folders HOT 4
- Image size detection for remote file
- content not building HOT 9
- s.image add option to not copy the file to a folder HOT 3
- Revise name of generated type HOT 1
- Imrpove DX on collection import HOT 2
- More framework or build tool integration examples HOT 1
- Array type pattern confuses typing HOT 1
- content not rebuilding when modify/change files under the 'content' directory using next 14.1.3 HOT 1
- Is there a way to add id to heading tags so that they can be used as anchor links? HOT 2
- I can display the main content - SyntaxError: Unexpected token '<' HOT 7
- Include image metadata from content source HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from velite.