knennigtri / merge-markdown

A tool to take in a list of markdown files and merge them with optional HTML/PDF output
76 stars 9 forks source link

Add simple example in README #57

Closed sanjarcode closed 5 months ago

sanjarcode commented 1 year ago

I have the following folder: image

How to generate a single md ? I couldn't figure it out using the README. Maybe add the trivial case first, before discussion variations in README

knennigtri commented 1 year ago

The main thing is you need to create a manifest file. You can see an example of one directly in the tool using help:

 merge-markdown -h manifest

For your usecase, it would be something like:

./manifest.yml

---
  input:
    home/1_motivation.md: ""
    home/2_resources.md: {noYAML: true}
    home/3_roadmap.md: {noYAML: true}
    home/4_resouce_itineraries: {noYAML: true}
    home/5_project.md: {noYAML: true}
    home/6_setup.md: {noYAML: true}
  output: 
    name: merged/myOutputFile.md
---

Then you can simply run the command:

    $ merge-markdown -m manifest.yml

Good luck!

sanjarcode commented 1 year ago

Can we add default command/option that creates this file automatically/at runtime? Since it's a simple mapping of the ls command.

knennigtri commented 10 months ago

It could be possible to do that, though the whole point of the manifest is the ability to merge/order markdown files anywhere. So in your case, a generate command makes sense, but if you have markdown files in different locations and different depths all over your project, it makes it more convoluted.

I suppose a generate command could just auto-add all .md files under a directory and after it's generated, you can reorder/delete .md files in the manifest as you see fit.

knennigtri commented 7 months ago

Added with --create <folder> command. bafd5bd226ff5a91fe176efd1792596af0f6bd89

Will auto-create an initial manifest file for you.