Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jstransformer-marked

Package Overview
Dependencies
Maintainers
7
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jstransformer-marked - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

20

index.js

@@ -1,2 +0,2 @@

const marked = require('marked').marked
const {marked} = require('marked')

@@ -10,5 +10,19 @@ const transformer = {

transformer.render = function (string, options) {
return marked(string, options)
return marked(string, { ...options, async: false })
}
module.exports = transformer
// Marked doesn't really support async rendering, but this enables async walkTokens extensions,
// see https://marked.js.org/using_pro#async
transformer.renderAsync = function (string, options) {
const rendered = marked(string, {
...options,
async: true,
})
if (rendered instanceof Promise) {
return rendered
}
return Promise.resolve(rendered)
}
module.exports = transformer

4

package.json
{
"name": "jstransformer-marked",
"version": "1.2.0",
"version": "1.3.0",
"description": "Marked support for JSTransformers.",

@@ -10,3 +10,3 @@ "keywords": [

"dependencies": {
"marked": "^4.0.17"
"marked": "^4.2.12"
},

@@ -13,0 +13,0 @@ "files": [

@@ -16,3 +16,3 @@ # jstransformer-marked

```js
let marked = require('jstransformer')(require('jstransformer-marked'));
const marked = require('jstransformer')(require('jstransformer-marked'));

@@ -24,4 +24,16 @@ marked.render('# Hello World!').body

marked.render('# "Hello World"', markedOptions)
// also supports async walkTokens
marked.renderAsync('# Hello World', {
walkTokens: async (token) => {
const uriPrefix = await uriPrefixAsync()
if (token.href) {
token.href = uriPrefix + token.href
}
}
})
```
For all supported options see https://marked.js.org/using_advanced#options
## License

@@ -32,2 +44,2 @@

[ci-badge]: https://github.com/jstransformers/jstransformer-marked/actions/workflows/test.yml/badge.svg
[ci-url]: https://github.com/jstransformers/jstransformer-marked/actions/workflows/test.yml
[ci-url]: https://github.com/jstransformers/jstransformer-marked/actions/workflows/test.yml
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc