You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-23Lines changed: 43 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,20 @@ CensorCore is a lightweight JavaScript library for detecting explicit, harmful,
7
7
8
8
Version 2.0 introduces a more advanced moderation engine with phrase detection, severity levels, async loading events, and a detailed `analyze()` API, while remaining fully backward‑compatible with the original `isBlocked()` function. CensorCore is suitable for chat applications, comment systems, forms, or any environment where user‑generated text requires screening.
9
9
10
-
Features
10
+
## Features
11
11
12
-
- Zero‑configuration setup - Shared JSON wordlist loaded from CDN - Phrase detection (supports multi‑word entries) - Automatic severity mapping based on category - Minimal and predictable API (isBlocked + analyze) - Async lifecycle events (onReady, onError) - Optional custom rule extension - No DOM modification or event interception - Full control retained by the integrating developer
13
12
14
-
Installation
13
+
- Zero‑configuration setup
14
+
- Shared JSON wordlist loaded from CDN
15
+
- Phrase detection (supports multi‑word entries)
16
+
- Automatic severity mapping based on category
17
+
- Minimal and predictable API (isBlocked + analyze)
18
+
- Async lifecycle events (onReady, onError)
19
+
- Optional custom rule extension
20
+
- No DOM modification or event interception
21
+
- Full control retained by the integrating developer
22
+
23
+
## Installation
15
24
16
25
To install CensorCore, include the script tag in the `<head>` of your HTML file to ensure it loads before your application code runs:
17
26
@@ -30,7 +39,7 @@ Make sure your internet connection allows loading scripts from the CDN at:
30
39
31
40
https://cdn.jsdelivr.net
32
41
33
-
Basic Integration
42
+
## Basic Integration
34
43
35
44
Inside your message‑sending logic, add this check:
36
45
@@ -66,7 +75,7 @@ function sendMessage() {
66
75
67
76
```
68
77
69
-
Advanced Usage (Version 2.0)
78
+
## Advanced Usage (Version 2.0)
70
79
71
80
Use the new `analyze()` API for detailed moderation results:
72
81
@@ -83,7 +92,7 @@ if (result.blocked) {
83
92
84
93
```
85
94
86
-
Custom Rules
95
+
## Custom Rules
87
96
88
97
You can add your own rules without modifying the main wordlist:
89
98
@@ -96,37 +105,48 @@ censor.extend([
96
105
97
106
```
98
107
99
-
Wordlist Structure
108
+
## Wordlist Structure
100
109
101
110
CensorCore loads a JSON file structured by category. Your actual wordlist includes categories such as:
Each category is automatically assigned a severity level (low, medium, or high). All categories are merged into a single internal rule engine.
106
126
107
127
The CensorCore wordlist is curated solely by Derrick Richard to ensure consistency and quality. Community members cannot directly edit the wordlist. To request a new word or phrase, please use the Word Request section in the repository's Discussions page.
108
128
109
-
API Reference
129
+
## API Reference
110
130
111
-
censor.isBlocked(text) Returns true if the text contains any blocked content.
131
+
`censor.isBlocked(text)` - Returns true if the text contains any blocked content.
112
132
113
-
censor.analyze(text) Returns a detailed moderation result including: - whether the text is blocked - highest severity - category - all matched rules
133
+
`censor.analyze(text)` Returns a detailed moderation result including: - whether the text is blocked - highest severity - category - all matched rules
114
134
115
-
censor.extend(rules) Adds custom moderation rules at runtime.
135
+
`censor.extend(rules)` - Adds custom moderation rules at runtime.
116
136
117
-
censor.isReady() Returns true when the wordlist has finished loading.
137
+
`censor.isReady()` - Returns true when the wordlist has finished loading.
118
138
119
-
censor.isFailed() Returns true if the wordlist failed to load.
139
+
`censor.isFailed()` - Returns true if the wordlist failed to load.
120
140
121
-
censor.onReady(callback) Fires when the moderation engine is ready.
141
+
`censor.onReady(callback)` - Fires when the moderation engine is ready.
122
142
123
-
censor.onError(callback) Fires if the moderation engine fails to load.
143
+
`censor.onError(callback)` - Fires if the moderation engine fails to load.
124
144
125
-
Design Philosophy
145
+
## Design Philosophy
126
146
127
147
CensorCore avoids modifying the DOM, intercepting events, or altering UI behavior. Instead, it provides a predictable, developer‑controlled moderation function. This ensures transparency, stability, and compatibility across a wide range of applications.
128
148
129
-
About the Developer
149
+
## About the Developer
130
150
131
151
CensorCore was created and is maintained by Derrick Richard, a high school developer focused on building practical, lightweight tools for the web.
132
152
@@ -136,14 +156,14 @@ More information about his work is available at: https://derrickrichard.github.i
136
156
137
157
The CensorCore wordlist is curated solely by Derrick Richard to ensure consistency and quality. Community members cannot directly edit the wordlist. To request a new word or phrase, please submit a request in the Word Request section of the repository's Discussions page.
138
158
139
-
Versions
159
+
## Versions
140
160
141
-
v1.0.0 -- Initial release with basic filtering functionality and a basic JSON wordlist.
161
+
v1.0.0 - Initial release with basic filtering functionality and a basic JSON wordlist.
142
162
143
-
v1.1.0 -- CensorCore v1.1.0 makes the filtering engine faster and more dependable. The wordlist is now processed ahead of time, the matching is quicker, and the library handles text in a more consistent way. The code has also been cleaned up so it is easier to follow and maintain. This update adds helper functions to check whether the wordlist has loaded or if something went wrong. The public API is locked to prevent accidental modification, and the library behaves more safely if used before loading finishes.
163
+
v1.1.0 - CensorCore v1.1.0 makes the filtering engine faster and more dependable. The wordlist is now processed ahead of time, the matching is quicker, and the library handles text in a more consistent way. The code has also been cleaned up so it is easier to follow and maintain. This update adds helper functions to check whether the wordlist has loaded or if something went wrong. The public API is locked to prevent accidental modification, and the library behaves more safely if used before loading finishes.
144
164
145
-
v2.0.0 -- CensorCore v2.0.0 is a major upgrade that introduces phrase detection, automatic severity levels, async lifecycle events, a detailed analyze() API, and custom rule support. The internal rule engine has been redesigned for clarity and flexibility while remaining fully backward‑compatible with the original isBlocked() function.
165
+
v2.0.0 - CensorCore v2.0.0 is a major upgrade that introduces phrase detection, automatic severity levels, async lifecycle events, a detailed analyze() API, and custom rule support. The internal rule engine has been redesigned for clarity and flexibility while remaining fully backward‑compatible with the original isBlocked() function.
0 commit comments