Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasmark79 authored Sep 20, 2024
1 parent f862198 commit beb2e30
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
```markdown
# masscode2md

`masscode2md` is a simple tool for converting code snippets from a JSON format into Markdown files. The project reads a JSON file containing code snippets and organizes them into folders based on the specifications in the JSON file.
`masscode2md` is a lightweight tool designed to convert code snippets stored in JSON format into organized Markdown files. The tool reads a JSON file containing code snippets and automatically arranges them into directories based on the provided structure in the JSON file.

## Requirements
## Prerequisites

- C++ compiler
- [nlohmann/json](https://github.com/nlohmann/json) library
- CMake (optional for build system)
- C++ compiler supporting C++17 or later
- [nlohmann/json](https://github.com/nlohmann/json) library for JSON parsing
- CMake (optional, recommended for streamlined build process)

## Installation

1. Get the source code:
1. Clone the repository:

```sh
git clone [email protected]:tomasmark79/masscode2md.git
cd masscode2md
```

2. Download dependencies (nlohmann/json):
2. Install the required dependencies (nlohmann/json):

- Using vcpkg:
- Using `vcpkg`:

```sh
vcpkg install nlohmann-json
```

- Or you can include the library directly in the project by downloading `json.hpp` from [GitHub](https://github.com/nlohmann/json/releases).
- Alternatively, you can directly include the library in your project by downloading `json.hpp` from [GitHub](https://github.com/nlohmann/json/releases).

## Compilation

If you are using CMake, follow these steps:
If you prefer using CMake, follow these steps:

1. Create a build directory:

Expand All @@ -39,34 +38,36 @@ If you are using CMake, follow these steps:
cd build
```

2. Generate build system files and compile:
2. Generate the build system and compile the project:

```sh
cmake ..
cmake --build .
```

If you are not using CMake, you can compile directly using a C++ compiler:
Alternatively, if you are not using CMake, you can compile the project directly using a C++ compiler:

```sh
g++ -o masscode2md main.cpp -std=c++17 -lstdc++fs
```

## Usage

The program requires two arguments: the path to the input JSON file and the output directory.
The program accepts two command-line arguments: the path to the input JSON file and the output directory where the Markdown files will be saved.

```sh
./masscode2md <input_json_path> <output_directory>
```

For example:
### Example

```sh
./masscode2md snippets.json output
```

## Example JSON File
## Example JSON Structure

Below is an example of the input JSON file:

```json
{
Expand All @@ -93,23 +94,20 @@ For example:
}
```

## Code Description
## Functionality Overview

The main function of the program performs the following steps:
The core functionality of `masscode2md` is as follows:

1. Loads the path to the JSON file and the output directory from the input arguments.
2. If the `ERASE_OUTPUT_DIR_AT_STARTUP` macro is set to `true`, it deletes the contents of the output directory at program startup.
3. Loads and parses the JSON file.
4. Creates folders specified in the JSON file.
5. Creates Markdown files for each code snippet that is not marked as deleted.
1. The program accepts two input arguments: the path to the JSON file and the desired output directory.
2. If the `ERASE_OUTPUT_DIR_AT_STARTUP` macro is defined as `true`, the output directory's contents will be cleared upon program startup.
3. The program parses the JSON file and reads the structure of folders and snippets.
4. Folders specified in the JSON are created in the output directory.
5. For each snippet that is not marked as deleted (`isDeleted: false`), a Markdown file is generated containing the snippet’s code.
## License
This project is licensed under the MIT License. For more information, see the LICENSE file.
This project is licensed under the MIT License. For more information, please refer to the `LICENSE` file.
## Author
This project was created by [Tomáš Mark]([email protected]:tomasmark79/masscode2md.git).
```
This `README.md` contains basic information about the project, how to install, compile, and use it. If you have any specific requirements or additional information you'd like to include, feel free to add them.
Developed and maintained by [Tomáš Mark]([email protected]:tomasmark79/masscode2md.git).

0 comments on commit beb2e30

Please sign in to comment.