mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Add an `mdbook rename` or `mdbook mv` command?

Open fitzgen opened this issue 1 year ago • 0 comments

To rename a file and update all of the links to that file within the book.

Example

Initial State

Say I start out with the following book:

  • src/SUMMARY.md:

    # Summary
    
    * [Foo](./foo.md)
    * [Bar](./bar.md)
    
  • src/foo.md:

    Also check out [bar](./bar.md)
    
  • src/bar.md:

    Wow!
    

Rename bar.md to wow.md

I want to rename bar.md to wow.md, but I don't want my links to break, so I run this command:

$ mdbook rename bar.md wow.md

Final State

And I end up with this final state:

  • src/SUMMARY.md:

    # Summary
    
    * [Foo](./foo.md)
    * [Bar](./wow.md)
    
  • src/foo.md:

    Also check out [bar](./wow.md)
    
  • src/wow.md:

    Wow!
    

fitzgen avatar Aug 27 '22 22:08 fitzgen