
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
gatsby-source-copy
Advanced tools
gatsby-source-copy
The easiest way to source copy from non-technical members of your team
yarn add gatsby-source-copy
npm install --save gatsby-source-copy
gatsby-config.js
module.exports = {
plugins: [
{
resolve: 'gatsby-source-copy',
options: {
documents: [
{
key: '<SOME_UNIQUE_KEY>',
id: '<GOOGLE_DOC_ID>',
},
],
},
},
],
}
All queried documents will return a node with content
containing a raw
field
with the text of the source document.
If a format
has been specified, content
will also contain the parsed data of
the document, accessed with the target format as the key. The return-type of the
formatted data depends on the format specified. For more details consult the
documentation of your desired format option.
query CopyQuery {
allCopy {
edges {
node {
content {
raw
archieml {
document_title
}
markdown {
tokens {
type
text
}
}
}
}
}
}
}
To ensure your Google Document can be sourced, make sure you have enabled anyone with a link to view the file. This can be configured in the "Share" menu.
Sourcing content with gatsby-source-copy
requires configuration containing the
IDs of the target documents. This ID can be found in your Google Doc URL, commonly
between d/
and /edit
. For example, a document with the URL
https://docs.google.com/document/d/dj2k3/edit
, has the ID dj2k3
.
Typically, Gatsby sites utilize transformer plugins to parse content for you to
query. For example, gatsby-transformer-remark
for transforming markdown. To provide better ergonomics for querying content,
this plugin provides support for parsing several popular markup languages
used for authoring copy. This enables simpler queries by exposing the parsed
content alongside the raw text that was sourced.
By default, gatsby-source-copy
will not parse your content but return the
raw text of the document. To parse the contents of the document, provide a
format
configuration option. This option can be set globally or per document.
gatsby-source-copy
currently supports parsing Markdown
and ArchieML.
// global
{
resolve: 'gatsby-source-copy',
options: {
format: "markdown",
documents: [...]
}
}
// per document
{
resolve: 'gatsby-source-copy',
options: {
documents: [
{key: 'foo', id: 'ajCe2', format: "archieml"},
{key: 'bar', id: 'a9rcf', format: "markdown"},
}
]
}
}
Format | Key | Parser | Example |
---|---|---|---|
Markdown | "markdown" | marked.js | examples/markdown.md |
ArchieML | "archieml" | archieml-js | examples/archieml.txt |
Can't find the format you're looking for? Open an issue or add your own!
This project is open to and encourages contributions! Feel free to discuss any bug fixes/features in the issues. If you wish to work on this project:
git checkout -b new-branch
)git commit -am 'add new feature'
)git push origin new-branch
)v0.1.3 - 23-07-2020
FAQs
Easiest way to source copy for a Gatsby site
We found that gatsby-source-copy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.