Is your feature request related to a problem? Please describe.
I prefer to use individual page markdown files, but I also like to bundle pictures if I've got 'em. So I go back and forth between page bundles and pages pretty often.
Describe the solution you'd like
I would love a menu command that would convert 2022-09-12-hot-topic-blog-post.md to 2022-09-12-hot-topic-blog-post/index.md and vice-versa.
Describe alternatives you've considered
Oh, it's not that hard to do by hand. I've also considered writing my own extension. But it seems like a natural fit here, too.
**Is your feature request related to a problem? Please describe.**
I prefer to use individual page markdown files, but I also like to bundle pictures if I've got 'em. So I go back and forth between page bundles and pages pretty often.
**Describe the solution you'd like**
I would love a menu command that would convert `2022-09-12-hot-topic-blog-post.md` to `2022-09-12-hot-topic-blog-post/index.md` and vice-versa.
**Describe alternatives you've considered**
Oh, it's not that hard to do by hand. I've also considered writing my own extension. But it seems like a natural fit here, too.
<!-- github-sync-id:1370369166 -->
@grahampcharles I've been thinking, going from a page to a page bundle that is easy, but from a page bundle to a file, that is a bit more difficult.
A page bundle can have various files like the assets. Where would the assets go, or how would you see this behaviour?
@grahampcharles I've been thinking, going from a page to a page bundle that is easy, but from a page bundle to a file, that is a bit more difficult.
A page bundle can have various files like the assets. Where would the assets go, or how would you see this behaviour?
<!-- github-comment-id:1262360166 -->
Yeah, that's a good point. I really only do this to go from my-page.md to my-page/index.md. I don't know that I ever go the other direction and in fact I lately have been using exclusively page bundles... it's just easier to start that way.
Anyway, here's my bundle.js source if it'll do you any good -- I used this to convert a whole directory to bundles.
var fs = require("fs");
const rootDir = `${__dirname}\\content\\posts\\`;
var files = fs.readdirSync(rootDir);
// files = [files[0]]; // uncomment to just act on one file, for testing
files
.filter((file) => file.endsWith(".md"))
.forEach((file) => {
const dir = `${rootDir}${file.slice(0, -3)}\\`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
fs.rename(
`${rootDir}${file}`,
`${rootDir}${file.slice(0, -3)}\\index.md`,
function (err) {
if (err) throw err;
console.log(`${file} moved successfully`);
}
);
}
});
Yeah, that's a good point. I really only do this to go from `my-page.md` to `my-page/index.md`. I don't know that I ever go the other direction and in fact I lately have been using exclusively page bundles... it's just easier to start that way.
Anyway, here's my `bundle.js` source if it'll do you any good -- I used this to convert a whole directory to bundles.
```
var fs = require("fs");
const rootDir = `${__dirname}\\content\\posts\\`;
var files = fs.readdirSync(rootDir);
// files = [files[0]]; // uncomment to just act on one file, for testing
files
.filter((file) => file.endsWith(".md"))
.forEach((file) => {
const dir = `${rootDir}${file.slice(0, -3)}\\`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
fs.rename(
`${rootDir}${file}`,
`${rootDir}${file.slice(0, -3)}\\index.md`,
function (err) {
if (err) throw err;
console.log(`${file} moved successfully`);
}
);
}
});
```
<!-- github-comment-id:1264741235 -->
@grahampcharles had also written the code to convert it to a page bundle, it is when I started to write down the steps for the other way this blocker came up.
If the script gets rewritten, it can become a custom script. Have been thinking about a store/collection-like feature, where the community can share, and others can fetch and use these. Check: https://github.com/estruyf/vscode-front-matter/discussions/420
@grahampcharles had also written the code to convert it to a page bundle, it is when I started to write down the steps for the other way this blocker came up.
If the script gets rewritten, it can become a `custom script`. Have been thinking about a store/collection-like feature, where the community can share, and others can fetch and use these. Check: https://github.com/estruyf/vscode-front-matter/discussions/420
<!-- github-comment-id:1264975017 -->
FWIW, my pre-page-bundle approach was to place ./slug.md alongside ./slug/image.png. This seems like a reasonable default for conversion from page bundle (./slug/index.md) to unbundled.
FWIW, my pre-page-bundle approach was to place `./slug.md` alongside `./slug/image.png.` This seems like a reasonable default for conversion from page bundle (`./slug/index.md`) to unbundled.
<!-- github-comment-id:1374848183 -->
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.
Is your feature request related to a problem? Please describe.
I prefer to use individual page markdown files, but I also like to bundle pictures if I've got 'em. So I go back and forth between page bundles and pages pretty often.
Describe the solution you'd like
I would love a menu command that would convert
2022-09-12-hot-topic-blog-post.mdto2022-09-12-hot-topic-blog-post/index.mdand vice-versa.Describe alternatives you've considered
Oh, it's not that hard to do by hand. I've also considered writing my own extension. But it seems like a natural fit here, too.
It indeed is a natural fit and would make a good enhancement.
@grahampcharles I've been thinking, going from a page to a page bundle that is easy, but from a page bundle to a file, that is a bit more difficult.
A page bundle can have various files like the assets. Where would the assets go, or how would you see this behaviour?
Yeah, that's a good point. I really only do this to go from
my-page.mdtomy-page/index.md. I don't know that I ever go the other direction and in fact I lately have been using exclusively page bundles... it's just easier to start that way.Anyway, here's my
bundle.jssource if it'll do you any good -- I used this to convert a whole directory to bundles.@grahampcharles had also written the code to convert it to a page bundle, it is when I started to write down the steps for the other way this blocker came up.
If the script gets rewritten, it can become a
custom script. Have been thinking about a store/collection-like feature, where the community can share, and others can fetch and use these. Check: https://github.com/estruyf/vscode-front-matter/discussions/420FWIW, my pre-page-bundle approach was to place
./slug.mdalongside./slug/image.png.This seems like a reasonable default for conversion from page bundle (./slug/index.md) to unbundled.