-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Allow custom scripts for custom placeholders #352
Labels
Comments
Testing out with the following implementation: {
"frontMatter.taxonomy.contentTypes": [
{
"name": "test",
"pageBundle": false,
"fields": [
{
"title": "Title",
"name": "title",
"type": "string"
},
{
"title": "Unique ID",
"name": "uniqueId",
"type": "string",
"default": "{{uniqueId}}"
},
]
}
],
"frontMatter.content.placeholders": [
{
"id": "uniqueId",
"script": "./scripts/uniqueId.js",
"command": "~/.nvm/versions/node/v16.13.1/bin/node"
}
]
} The script gets two arguments:
const arguments = process.argv;
if (arguments && arguments.length > 0) {
const workspaceArg = arguments[2];
const filePath = arguments[3];
const title = arguments[4];
console.log(Math.random().toString(36).substring(2, 15));
} The outcome of the newly generated file its front matter: |
Another test with a known placeholder from Front Matter: {
"frontMatter.taxonomy.contentTypes": [
{
"name": "test",
"pageBundle": false,
"fields": [
{
"title": "Title",
"name": "title",
"type": "string"
},
{
"title": "Random",
"name": "random",
"type": "string",
"default": "{{uniqueId}}-{{slug}}"
},
]
}
]
} |
estruyf
added a commit
that referenced
this issue
Jul 21, 2022
estruyf
added a commit
that referenced
this issue
Jul 27, 2022
|
Merged
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To further enhance the placeholders that can be used in the content types. It would be good to investigate if it would be possible to have a custom script capability.
The text was updated successfully, but these errors were encountered: