Docutils transformer for Gridsome.
This transformer parses docutils xml documents with the docutils package. You can use it to load documentation generated by tools like sphinx in Gridsome collections.
You can install gridsome-transformer-docutils with your npm client of choice.
$ npm install --save-dev gridsome-transformer-docutilsAfter installing the package as a development dependency, you can configure @gridsome/source-filesystem to load the generated xml files.
// gridsome.config.js
module.exports = {
plugins: [
{
use: '@gridsome/source-filesystem',
options: {
typeName: 'SphinxDocument',
baseDir: 'sphinx/dist',
path: '**/*.xml',
docutils: {
// Options
}
}
}
],
templates: {
SphinxDocument: node => node.path
},
transformers: {
docutils: {
// Global options
}
}
}You can configure the transformer globally or for specific filesystem sources.
-
pluginsDefaults to
[]. An array of plugins passed to the docutils parser.
In addition to the fields provided by the source-filesystem plugin, the transformer generates a JSON field containing the parsed document.
-
rootThe document parsed as a hierarchy of plain JavaScript objects. Check out the docutils documentation for more details.
Contributions are welcome. This project uses jest for testing.
$ npm testThe code follows the javascript standard style guide.
$ npm run lintLicense - MIT