Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
uniorg-extract-keywords
Advanced tools
Readme
uniorg-extract-keywords
uniorg plugin to extract Org-mode keywords from the document and store them in vfile.data.
npm install --save uniorg-extract-keywords
If we have the following example.org
file:
#+TITLE: Post title
#+AUTHOR: Your Name
other org-mode
and
import { unified } from 'unified';
import toVFile from 'to-vfile';
import uniorgParse from 'uniorg-parse';
import { extractKeywords } from 'uniorg-extract-keywords';
import uniorg2rehype from 'uniorg-rehype';
import html from 'rehype-stringify';
unified()
.use(uniorgParse)
.use(extractKeywords)
.use(uniorg2rehype)
.use(html)
.process(toVFile.readSync('./example.org'), function (err, file) {
console.log(file.toString());
console.log(file.data);
});
will output
<p>other org-mode
</p>
{ title: 'Post title', author: 'Your Name' }
Note: you should use to-vfile@6. to-vfile@7 is currently incompatible with unified@9. See #12 for more details.
Type: string?
Default: undefined
Specify a key to store keywords under. For example, { name: 'keywords' }
will store all keyword values as { data: { keywords: { ... } } }
. By default, all keywords are merged into the data
object.
Example:
unified()
.use(uniorgParse)
.use(extractKeywords, { name: 'keywords' })
.use(uniorg2rehype)
.use(html)
.process('#+TITLE: Example', function (err, file) {
console.log(file.data);
});
will output
{ keywords: { title: 'Example' } }
Type: boolean
Default: false
Whether to preserve case of the keywords. By default, all keywords are converted to lowercase.
Example:
unified()
.use(uniorgParse)
.use(extractKeywords, { preserveCase: true })
.use(uniorg2rehype)
.use(html)
.process('#+TITLE: Example', function (err, file) {
console.log(file.data);
});
will output
{ TITLE: 'Example' }
FAQs
Store org keywords and their values in vfile data property
The npm package uniorg-extract-keywords receives a total of 100 weekly downloads. As such, uniorg-extract-keywords popularity was classified as not popular.
We found that uniorg-extract-keywords demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.