Skip to content

Conversation

@arshinsikka
Copy link

@arshinsikka arshinsikka commented Jun 26, 2025

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

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 2025-06-26 at 10 51 05 PM

📷 Screenshot 2 – Terminal output
Demonstrates successful execution of the markbind init test-site --auto-title command.
Screenshot 2025-06-26 at 10 55 48 PM

📷 Screenshot 3 – Project structure
Highlights that the test-site directory was generated with the expected files.
Screenshot 2025-06-26 at 10 56 16 PM

📷 Screenshot 4 – Multiple markdown files with auto-titles
Confirms that the auto-title logic correctly applies to all .md files in the directory.
Screenshot 2025-06-26 at 10 57 03 PM
Screenshot 2025-06-26 at 10 57 07 PM
Screenshot 2025-06-26 at 10 57 11 PM
Screenshot 2025-06-26 at 10 57 15 PM

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: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes <!-- It's tempting, but increases the reviewer's work, and really pollutes the commit history
  • Added screenshots for visual verification
  • =( -->

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

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.toml to bypass submodule cloning (GIT_SUBMODULE_STRATEGY = "none"). Please let me know if this should be reverted post-review.

@arshinsikka
Copy link
Author

I attempted multiple fixes but the Netlify deploy preview continues to fail. Closing this PR and will explore an alternative approach or related issue instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto generate titles

1 participant