
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@diplodoc/html-extension
Advanced tools
This is an extension of the Diplodoc platform, which allows adding HTML in the documentation.
The extension contains some parts:
Attach the plugin to the transformer:
import htmlExtension from '@diplodoc/html-extension';
import transform from '@diplodoc/transform';
import * as sanitizeHtml from 'sanitize-html';
const {result} = await transform(`
::: html
<article class="forecast">
<h1>Weather forecast for Seattle</h1>
<article class="day-forecast">
<h2>12 June 2024</h2>
<p>Rain.</p>
</article>
<article class="day-forecast">
<h2>13 June 2024</h2>
<p>Periods of rain.</p>
</article>
<article class="day-forecast">
<h2>14 June 2024</h2>
<p>Heavy rain.</p>
</article>
</article>
:::
`, {
plugins: [
htmlExtension.transform({
sanitize: dirtyHtml => sanitizeHtml(dirtyHtml, {
allowedTags: ['article', 'h1', 'h2', 'p', 'span'],
allowedAttributes: {
'*': ['class']
}
}),
containerClasses: 'my-own-class'
})
]
});
It is necessary to add runtime
scripts to make html interactive on your page.
You can add assets files which were generated by the MarkdownIt transform plugin.
<html>
<head>
<!-- Read more about '_assets/html-extension.js' and '_assets/html-extension.css' in 'Transform plugin' section -->
<script src='_assets/html-extension.js' async></script>
</head>
<body>
${result.html}
</body>
</html>
Or you can just include runtime's source code in your bundle.
import '@diplodoc/html-extension/runtime'
Plugin for @diplodoc/transform package.
Options:
runtimeJsPath
- name on runtime script which will be exposed in results script
section.
Default: _assets/html-extension.js
bundle
- boolean flag to enable/disable copying of bundled runtime to target directory.
Where target directore is <transformer output option>/<plugin runtime option>
Default: true
containerClasses
- additional classes which will be added to tab's container node. It allows to customize the html view.
Example: my-own-class and-other-class
Default: undefined
This plugin uses the directive syntax proposed in the CommonMark community, indicated by a block-level double colon at the beginning and end of a block. This HTML directives use ::: html
to open an HTML block, followed by your HTML content, and then :::
to close the block. The number of empty lines before or after the opening or closing block is not significant.
Please note:
Simple example:
::: html
<div>Your HTML code is here</div>
:::
Example with some styles:
::: html
<style>
<style>
:root {
--dark-bg-color: #000;
--dark-text-color: #FFF;
}
.dark {
background-color: var(--primary-bg-color);
color: : var(--primary-text-color);
}
</style>
<div class="dark">Some info is here</div>
:::
You can use the React hook to interact programmatically with the HTML content inside the block.
// TODO
FAQs
HTML plugin for Diplodoc transformer and builder
The npm package @diplodoc/html-extension receives a total of 133 weekly downloads. As such, @diplodoc/html-extension popularity was classified as not popular.
We found that @diplodoc/html-extension demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.