feat(cli): add --auto-title flag to auto-generate markdown titles during init #2730
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request?
Closes #2297
Implements the PoC feature discussed in the MarkBind issue tracker to auto-generate titles for markdown files using their filenames during site initialization.
Overview of changes:
Added a new optional flag --auto-title to the markbind init CLI command.
When used, it parses all .md files under the site directory and automatically injects a title field into their frontmatter (if missing).
Capitalization and underscore-to-space replacement logic is applied (e.g., my_file_name.md becomes My File Name).
Anything you'd like to highlight/discuss:
This feature is implemented as a PoC (Proof-of-Concept) as part of NUS-OSS Summer Project (CP3108B).
The implementation is scoped only to .md files during the init process.
Does not overwrite files that already have a title field in frontmatter.
Testing instructions:
To test the functionality:
cd ~/Desktop
markbind init test-site --auto-title
Titles should be auto-generated in .md files inside test-site
You can verify by checking the top of each markdown file for a correctly inferred title.
Screenshots:

📷 Screenshot 1 – index.md showing auto-generated title
Shows the title field inserted at the top of a newly generated markdown file.
📷 Screenshot 2 – Terminal output

Demonstrates successful execution of the markbind init test-site --auto-title command.
📷 Screenshot 3 – Project structure

Highlights that the test-site directory was generated with the expected files.
📷 Screenshot 4 – Multiple markdown files with auto-titles




Confirms that the auto-title logic correctly applies to all .md files in the directory.
Proposed commit message: (wrap lines at 72 characters)
feat(cli): add --auto-title flag to auto-generate markdown titles
Adds an optional --auto-title flag to the init command.
When enabled, the CLI will automatically insert a title field
into the frontmatter of all markdown files using the filename
(with underscores replaced by spaces and capitalization applied).
This helps with mass conversion of docs into MarkBind websites.
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):
No breaking changes or API modifications. This is an optional CLI enhancement.
ℹ️ Note: The Netlify build was previously failing due to inaccessible submodules (e.g.,
guides). Since this PR doesn’t depend on submodules, I added a.netlify/netlify.tomlto bypass submodule cloning (GIT_SUBMODULE_STRATEGY = "none"). Please let me know if this should be reverted post-review.