
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
remark-with-images
Advanced tools
Remark plugin to get all images from `markdown` as an `array` and optionally update/replace them
remark plugin to get all images from
markdownas anarrayand optionally update/replace them
npm install remark-with-images --save
Say we have the following file, example.md:
# Title
Some text with inline 
Some other text...

Rest of the text...
And the javascript might look like:
import vfile from 'to-vfile'
import remark from 'remark'
import withImages from 'remark-with-images'
const parse = await (data) => {
const {
contents: markdown,
data: { images }
} = await remark()
.use(withImages)
.process(data)
// do something with markdown and images array
return {
markdown,
images
}
}
parse(vfile.readSync('example.md'))
images array would have this schema:
[
{
"alt": "image 1",
"original_url": "https://images.com/1.jpg"
},
{
"alt": "image 2",
"original_url": "https://images.com/2.jpg"
}
]
You also might want to reupload those images to some other place and then replace all the references. It's easy to do by just providing replace option:
import vfile from 'to-vfile'
import remark from 'remark'
import withImages from 'remark-with-images'
const replace = async (url, alt) => {
return new Promise((resolve) => {
setTimeout(() => {
const newUrl = url.replace('images.com', 'cloud.images.com')
resolve(newUrl)
}, 1000)
})
}
const parse = await (data) => {
const {
contents: markdown,
data: { images }
} = await remark()
.use(withImages, { replace })
.process(data)
// do something with updated markdown and images array
return {
markdown,
images
}
}
parse(vfile.readSync('example.md'))
markdown will become:
# Title
Some text with inline 
Some other text...

Rest of the text...
And images array would be:
[
{
"alt": "image 1",
"original_url": "https://images.com/1.jpg",
"url": "https://cloud.images.com/1.jpg"
},
{
"alt": "image 2",
"original_url": "https://images.com/2.jpg",
"url": "https://cloud.images.com/2.jpg"
}
]
FAQs
Remark plugin to get all images from `markdown` as an `array` and optionally update/replace them
We found that remark-with-images demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.