
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@speedy-js/code-title
Advanced tools
A markdown-it plugin to create named code blocks.
With this pllugin you can create named code blocks like:
```js:hello.js
console.log("Hello World!")
```
Rendered as:
<pre class="named-fence-block"><code class="language-js">console.log("Hello World!");
</code><div class="named-fence-filename">hello.js</div></pre>
After applying the css, it looks like this:
npm install markdown-it-named-code-blocks
Use this same as a normal markdown-it plugin:
var md = require('markdown-it');
var namedCodeBlocks = require('markdown-it-named-code-blocks');
var parser = md().use(namedCodeBlocks);
var str = '```js:hello.js\nconsole.log("Hello World!);```'
var result = parser.render(str);
Apply CSS like this:
.named-fence-block {
position: relative;
padding-top: 2em;
}
.named-fence-filename {
position: absolute;
top: 0;
left: 0;
padding: 0 4px;
font-weight: bold;
color: #000000;
background: #c0c0c0;
opacity: 0.6;
}
Rendered:
If you want to enable inline CSS:
var parser = md().use(namedCodeBlocks, {isEnableInlineCss: true});
<pre class="hljs named-fence-block" style="position: relative; padding-top: 2em"><code>console.log("Hello World!")
</code><div class="mincb-name" style="position: absolute; top: 0; left: 0; padding: 0 4px; font-weight: bold; color: #000000; background: #c0c0c0; opacity: .6;">hello.js</div></pre>
Distributed under the MIT
License. See LICENSE for more information.
FAQs
A markdown-it plugin to create named code blocks.
The npm package @speedy-js/code-title receives a total of 0 weekly downloads. As such, @speedy-js/code-title popularity was classified as not popular.
We found that @speedy-js/code-title demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.