posva / markdown-it-custom-block Goto Github PK
View Code? Open in Web Editor NEWHandle custom blocks transformations for markdown-it
License: MIT License
Handle custom blocks transformations for markdown-it
License: MIT License
Repo url is invalid in the package.json
file -> npm repo link is wrong.
"repository": {
"type": "git",
"url": "git+https://github.com/posva/vue-mdc.git"
},
The lib cannot handle multiple occurrences of the same custom block.
Using the same custom block twice without separation. The lib cannot transform the blocks at all.
const md = markdownit().use(customBlock, {
example (arg) {
return `<example-${arg}/>`
}
})
---
desc: Element
---
Two occurrences no separation
.
@[example](button1)
@[example](button2)
.
<example-button1/>
<example-button2/>
.
Custom Blocks
Element
1) Two occurrences no separation
0 passing (42ms)
1 failing
1) Custom Blocks Element Two occurrences no separation:
AssertionError: expected '<p>@<a href="button1">example</a>\n@<a href="button2">example</a></p>\n' to equal '<example-button1/>\n<example-button2/>\n'
+ expected - actual
-<p>@<a href="button1">example</a>
-@<a href="button2">example</a></p>
+<example-button1/>
+<example-button2/>
at Function.assert.strictEqual (node_modules/chai/lib/chai/interface/assert.js:169:32)
at Context.<anonymous> (node_modules/markdown-it-testgen/index.js:188:26)
Using the same custom block twice with an empty line between them. The first transform will be repeated twice.
const md = markdownit().use(customBlock, {
example (arg) {
return `<example-${arg}/>`
}
})
---
desc: Element
---
Two occurrences with separation
.
@[example](button1)
@[example](button2)
.
<example-button1/>
<example-button2/>
.
Custom Blocks
Element
1) Two occurrences with separation
0 passing (38ms)
1 failing
1) Custom Blocks Element Two occurrences with separation:
AssertionError: expected '<example-button1/>\n<example-button1/>\n' to equal '<example-button1/>\n<example-button2/>\n'
+ expected - actual
<example-button1/>
-<example-button1/>
+<example-button2/>
at Function.assert.strictEqual (node_modules/chai/lib/chai/interface/assert.js:169:32)
at Context.<anonymous> (node_modules/markdown-it-testgen/index.js:188:26)
This issue provides visibility into Renovate updates and their statuses. Learn more
These updates are awaiting their schedule. Click on a checkbox to get an update now.
The regex does not match stuff like this
@[hello](
hi
)
because the dot in JS does not match newlines even with the m modifier. See https://simonwillison.net/2004/Sep/20/newlines/. The regex needs to look like this
const embedRE = /@\[([\w-]+)\]\(([\s\S]+)\)/im;
Is it possible to use more than one template literal?
const customBlock = require('markdown-it-custom-block')
markdownit()
.use(customBlock, {
test (one, two) {
return `<div class="one">${one}</div><div class="two">${two}</div>`
}
})
@[test](One),(Two)
At the moment it's necessary to add a blank line between blocks:
@[example](button1)
@[example](button2)
I'm open to contributions to make this work:
@[example](button1)
@[example](button2)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.