It doesn't work though in my tests. A very simple sample:
(async () => {
// something is done
// and then
return '{ "frontmatter": { "bla": "fasel" }}';
}
})();
... this is not updating the frontmatter in the markdown file from where I called the action. The main problem is probably just that the one paragraph describing the feature is not enough.
Questions:
does bla have to exist to be "updated"?
how can I add new frontmatter
frontmatter - do you expect it to be JSON, YAML, TOML? can Front Matter handle different frontmatter formats?
is return the right way or does Front Matter expect an echo-output?
is returning a stringified JSON right or should an object be returned?
could you maybe add a sample?
The above script returns 'Front Matter: Retrieve Unsplash image: undefined' as notification (where the retrieve unsplash image part is the title of the action).
https://frontmatter.codes/docs/custom-actions#updating-the-front-matter says something along the lines of returning a json structure to update the frontmatter.
It doesn't work though in my tests. A very simple sample:
```
(async () => {
// something is done
// and then
return '{ "frontmatter": { "bla": "fasel" }}';
}
})();
```
... this is not updating the frontmatter in the markdown file from where I called the action. The main problem is probably just that the one paragraph describing the feature is not enough.
Questions:
- does `bla` have to exist to be "updated"?
- how can I _add_ new frontmatter
- frontmatter - do you expect it to be JSON, YAML, TOML? can Front Matter handle different frontmatter formats?
- is return the right way or does Front Matter expect an echo-output?
- is returning a stringified JSON right or should an object be returned?
- could you maybe add a sample?
The above script returns 'Front Matter: Retrieve Unsplash image: undefined' as notification (where the retrieve unsplash image part is the title of the action).
<!-- github-sync-id:1331025316 -->
You're almost there, but it is the documentation that can be optimized here.
A custom action/script needs to return data via logging it to the output, as that is what the extension will receive and process.
In your case, the script should be as follows:
(async()=>{// something is done
// and then
console.log('{ "frontmatter": { "bla": "fasel" }}');}})();
Answers:
does bla have to exist to be "updated"?
Nope, this can be added by the script
how can I add new frontmatter
Example above
frontmatter - do you expect it to be JSON, YAML, TOML? can Front Matter handle different frontmatter formats?
Should be JSON
is return the right way or does Front Matter expect an echo output?
Think the above sample helps you with this
is returning a stringified JSON right or should an object be returned?
Yep, this is correct
could you maybe add a sample?
Example above
You're almost there, but it is the documentation that can be optimized here.
A custom action/script needs to return data via logging it to the output, as that is what the extension will receive and process.
In your case, the script should be as follows:
```javascript
(async () => {
// something is done
// and then
console.log('{ "frontmatter": { "bla": "fasel" }}');
}
})();
```
Answers:
> does bla have to exist to be "updated"?
Nope, this can be added by the script
> how can I add new frontmatter
Example above
> frontmatter - do you expect it to be JSON, YAML, TOML? can Front Matter handle different frontmatter formats?
Should be JSON
> is return the right way or does Front Matter expect an echo output?
Think the above sample helps you with this
> is returning a stringified JSON right or should an object be returned?
Yep, this is correct
> could you maybe add a sample?
Example above
<!-- github-comment-id:1207789405 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
https://frontmatter.codes/docs/custom-actions#updating-the-front-matter says something along the lines of returning a json structure to update the frontmatter.
It doesn't work though in my tests. A very simple sample:
... this is not updating the frontmatter in the markdown file from where I called the action. The main problem is probably just that the one paragraph describing the feature is not enough.
Questions:
blahave to exist to be "updated"?The above script returns 'Front Matter: Retrieve Unsplash image: undefined' as notification (where the retrieve unsplash image part is the title of the action).
You're almost there, but it is the documentation that can be optimized here.
A custom action/script needs to return data via logging it to the output, as that is what the extension will receive and process.
In your case, the script should be as follows:
Answers:
Nope, this can be added by the script
Example above
Should be JSON
Think the above sample helps you with this
Yep, this is correct
Example above