![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
mrk is an easily extendable markdown parser created for Decent. We needed it for a few reasons:
Include mrk.js in your page, or npm install mrkjs
:
Usage is as follows:
// require('mrk.js') or <script src='mrk.js'></script>
let mark = mrk()
let html = mark('Some _markdown_').html()
console.log(html)
That's it! You can also directly access the parsed token stream by looking at mark(...).tokens
, if you're so inclined.
Promise
?Yes!!
const mrk = require('mrk.js/async')
const mark = mrk()
mark('Awesome!').then(parsed => {
console.log('tokens:', parsed.tokens)
return parsed.html()
}).then(html => {
console.log('HTML:', html)
})
You can implement/remove it yourself. mrk was designed to be easily extendable:
mark('Visit http://google.com').html() // Visit <a href='http://google.com'>http://google.com</a>
delete mark.patterns.autolink // See mrk.js for other patterns/features you can remove
mark('Visit http://google.com').html() // Visit http://google.com
Say we wanted to add ~~strikethrough~~
text, GFM-style:
// Pass `mrk()` extensions to patterns, pairs, or htmlify
const markWithStrikethrough = mrk({
extendPatterns: {
strikethroughStart: ({ read, has }) => {
// If this function returns a truthy value, it will be parsed as a strikethroughStart token
// See mrk.js for how `read` and `has` work, plus other functions you get access to.
return read(2) === '~~' // Next 2 characters should be `~~`
&& !has('strikethroughStart', 'strikethroughEnd') // Not already strikethrough!
},
strikethroughEnd: ({ read, has }) => {
return read(2) === '~~' // Next 2 characters should be `~~`
&& has('strikethroughStart', 'strikethroughEnd') // Must have a strikethroughStart before this token
},
},
extendPairs: {
// If there is a strikethroughStart token on its own without a strikethroughEnd token to be paired
// to, it will be discarded and parsed as text.
strikethroughStart: 'strikethroughEnd'
},
extendHtmlify: {
// Declares how to convert these tokens into HTML strings.
strikethroughStart = () => '<s>',
strikethroughEnd = () => '</s>'
}
})
// :tada:
mrk('~~hello~~').html() // => <s>hello</s>
If you end up creating an extension for mrk for your project and it's generic enough, please consider adding it to the list of community extensions for mrk. I'd appreciate it!
MIT :tada:
FAQs
The happy little extendable markdown parser
The npm package mrk.js receives a total of 3 weekly downloads. As such, mrk.js popularity was classified as not popular.
We found that mrk.js 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.