Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@diplodoc/file-extension
Advanced tools
This is an extension of the Diplodoc platform, which allows adding links to files in the documentation.
The extension contains some parts:
Attach the plugin to the transformer:
import * as fileExtension from '@diplodoc/file-extension';
import transform from '@diplodoc/transform';
const {result} = await transform(
`
Download here: {% file src="path/to/file" name='readme.md' %}
`,
{
plugins: [fileExtension.transform({bundle: false})],
},
);
It is necessary to add styles for file links on your page.
You can add assets files which were generated by the MarkdownIt transform plugin.
<html>
<head>
<!-- Read more about '_assets/file-extension.css' in 'Transform plugin' section -->
<link rel="stylesheet" href="_assets/file-extension.css" />
</head>
<body>
${result.html}
</body>
</html>
Or you can just include styles source code in your bundle.
import '@diplodoc/cut-extension/runtime/styles.css';
Plugin for @diplodoc/transform package.
Options:
runtime.style
- name on runtime css file which will be exposed in results style
section.
(Default: _assets/file-extension.css
)
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
{% file src="path/to/file" name='readme.md' %}
==>
<a href="path/to/file" download="readme.md" class="yfm-file"><span class="yfm-file__icon"></span>readme.md</a>
Name | Required | Description |
---|---|---|
src | yes | URL of the file. Will be mapped to href attribute |
name | yes | Name of the file. Will be mapped to download attribute |
lang | - | Language of the file content. Will be mapped to hreflang attribute |
referrerpolicy | - | referrerpolicy attribute |
rel | - | rel attribute |
target | - | target attribute |
type | - | type attribute |
Note: other attributes will be ignored
Name | Type | Description |
---|---|---|
fileExtraAttrs | [string, string][] | Adds additional attributes to rendered hyperlink |
--yfm-file-icon
– sets custom file icon image--yfm-file-icon-color
– sets custom file icon colorFAQs
Template package for Diplodoc platform development
The npm package @diplodoc/file-extension receives a total of 73 weekly downloads. As such, @diplodoc/file-extension popularity was classified as not popular.
We found that @diplodoc/file-extension demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.