Skip to content

Commit d9caedb

Browse files
authored
Merge pull request #128 from MekDrop/improve-readme-file
Improve README.md
2 parents c67c13e + 8a996a0 commit d9caedb

File tree

1 file changed

+77
-37
lines changed

1 file changed

+77
-37
lines changed

README.md

Lines changed: 77 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,105 @@
11
[![License](https://img.shields.io/github/license/impresscms-dev/flattern-markdown-folder-structure-action.svg)](LICENSE)
2-
[![GitHub release](https://img.shields.io/github/release/impresscms-dev/flattern-markdown-folder-structure-action.svg)](https://github.com/impresscms-dev/generate-php-project-classes-list-file-action/releases)
2+
[![GitHub release](https://img.shields.io/github/release/impresscms-dev/flattern-markdown-folder-structure-action.svg)](https://github.com/impresscms-dev/flattern-markdown-folder-structure-action/releases)
33

4-
# Flattern MarkDown folder structure
4+
# Flattern Markdown Folder Structure
55

6-
GitHub action to flattern file structure with [MarkDown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) data.
6+
A GitHub Action that flattens a directory structure containing Markdown files while preserving and updating internal links between documents.
7+
8+
## What This Action Does
9+
10+
This action:
11+
12+
1. Takes a directory containing Markdown files in a nested folder structure
13+
2. Moves all files to the root of that directory
14+
3. Renames files to avoid naming conflicts (adding folder path in parentheses when needed)
15+
4. Updates all internal links between documents to maintain proper references
16+
17+
This is particularly useful for documentation generation workflows where you want a flat structure for publishing or deployment.
718

819
## Usage
920

10-
To use this action in your project, create workflow in your project similar to this code (Note: some parts and arguments needs to be altered):
21+
To use this action in your project, create a workflow in your GitHub repository similar to this example (customize as needed):
1122
```yaml
12-
name: Generate documentation
23+
name: Generate and Flatten Documentation
1324

1425
on:
1526
push:
27+
branches: [main, master]
1628

1729
jobs:
18-
get_php_classes_list:
30+
flatten_docs:
1931
runs-on: ubuntu-latest
2032
steps:
21-
- name: Checkouting project code...
22-
uses: actions/checkout@v2
23-
24-
- name: Install PHP
25-
uses: shivammathur/setup-php@master
26-
with:
27-
php-version: 8.1
28-
extensions: curl, gd, pdo_mysql, json, mbstring, pcre, session
29-
ini-values: post_max_size=256M
30-
coverage: none
31-
tools: composer:v2
32-
33-
- name: Install Composer dependencies (with dev)
34-
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
35-
36-
- name: Generating documentation...
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
# Generate documentation (example using PHP docs generator)
37+
- name: Generate documentation
3738
uses: impresscms-dev/[email protected]
3839
with:
39-
class_root_namespace: ImpressCMS\
40-
included_classes: ImpressCMS\**
40+
class_root_namespace: YourNamespace\
41+
included_classes: YourNamespace\**
4142
output_path: ./docs/
42-
43-
- name: Flattering documentation...
44-
uses: impresscms-dev/[email protected]
43+
44+
# Flatten the documentation structure
45+
- name: Flatten documentation structure
46+
uses: impresscms-dev/flattern-markdown-folder-structure-action@v2
4547
with:
4648
path: ./docs/
47-
48-
- uses: actions/upload-artifact@v3
49+
50+
# Optional: Upload the flattened docs as an artifact
51+
- name: Upload documentation
52+
uses: actions/upload-artifact@v4
4953
with:
50-
name: my-artifact
54+
name: documentation
5155
path: ./docs/
5256
```
5357
5458
## Arguments
5559
56-
This action supports such arguments (used in `with` keyword):
57-
| Argument | Required | Default value | Description |
58-
|-------------|----------|----------------------|-----------------------------------|
59-
| path | Yes | | Folder to flattern |
60+
This action supports the following arguments (used with the `with` keyword):
61+
62+
| Argument | Required | Default value | Description |
63+
|----------|----------|---------------|-------------|
64+
| path | Yes | - | Path to the folder containing Markdown files that should be flattened |
65+
66+
## How File Renaming Works
67+
68+
When flattening the directory structure, the action:
69+
70+
1. Moves all files to the root directory
71+
2. If filename conflicts occur, the action renames files by adding the original folder path in parentheses
72+
- Example: `subfolder/document.md` becomes `document (subfolder).md`
73+
3. Updates all internal Markdown links to maintain proper references between documents
74+
75+
## Examples
76+
77+
### Before Flattening
78+
```
79+
docs/
80+
├── README.md
81+
├── getting-started.md
82+
├── api/
83+
│ ├── endpoints.md
84+
│ └── authentication.md
85+
└── guides/
86+
├── installation.md
87+
└── configuration.md
88+
```
89+
90+
### After Flattening
91+
```
92+
docs/
93+
├── README.md
94+
├── getting-started.md
95+
├── endpoints (api).md
96+
├── authentication (api).md
97+
├── installation (guides).md
98+
└── configuration (guides).md
99+
```
60100
61-
## How to contribute?
101+
## How to Contribute
62102
63-
If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try [interactive GitHub tutorial](https://skills.github.com).
103+
If you want to add functionality or fix bugs, you can fork the repository, make your changes, and create a pull request. If you're not sure how this works, check out GitHub's [fork a repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and [creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) guides.
64104
65-
If you found any bug or have some questions, use [issues tab](https://github.com/impresscms-dev/flattern-markdown-folder-structure-action/issues) and write there your questions.
105+
If you find a bug or have questions, please use the [issues tab](https://github.com/impresscms-dev/flattern-markdown-folder-structure-action/issues) to report them.

0 commit comments

Comments
 (0)