-
Notifications
You must be signed in to change notification settings - Fork 29
Create llms-txt-validation.js #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8461f5c
Create llms-txt-validation.js
chr156r33n 41b063a
Update llms-txt-validation.js
tunetheweb cae08e6
Update llms-txt-validation.js
tunetheweb c9dd288
Return JSON
tunetheweb c9f93ae
JSON stringify
tunetheweb 4aaada5
Update llms-txt-validation.js
tunetheweb cfd4af3
Rename llms-txt-validation.js to dist/llms-txt-validation.js
tunetheweb dc9ba7a
Update llms-txt-validation.js
tunetheweb 1bb9fb8
Update llms-txt-validation.js
tunetheweb 4b96095
Rename llms-txt-validation.js to llms_txt_validation.js
tunetheweb f1c6d6f
Update llms_txt_validation.js
tunetheweb 50de227
Change to Boolean
tunetheweb da43f5e
Merge branch 'main' into patch-1
max-ostapenko ca3538f
Validation Changes
chr156r33n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| //[llms-txt-valid] | ||
| return fetch('/llms.txt') | ||
| .then(response => { | ||
| if (!response.ok) return 0; | ||
| const ct = response.headers.get('Content-Type')||''; | ||
| if (!ct.toLowerCase().includes('text/plain')) return 0; | ||
| return response.text().then(text => { | ||
| const m = s=> (text.match(new RegExp(`\\${s}`,'g'))||[]).length; | ||
| if ((text.match(/```/g)||[]).length %2) return 0; | ||
| if (m('[')!==m(']')||m('(')!==m(')')) return 0; | ||
| return 1; | ||
| }); | ||
| }) | ||
| .catch(()=>0); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.