Skip to content

Commit

Permalink
fix(docs): spell check script
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixNicolaeBucsa committed Jan 8, 2025
1 parent 242558d commit 5eb5c7f
Show file tree
Hide file tree
Showing 2 changed files with 458 additions and 8 deletions.
12 changes: 4 additions & 8 deletions .github/spelling/check_spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
jsx_like_tags_pattern = re.compile(r'<[^>]*>[\s\S]*?<\/[^>]*>|<[^>]*?/>', re.DOTALL)
path_pattern = re.compile(r'path:\s*"/[^"]*"')
guidebox_pattern = re.compile(r'<GuideBox[\s\S]*?/>', re.IGNORECASE)
api_endpoint_pattern = re.compile(r'<ApiEndpointRequestResponse[\s\S]*?/>', re.IGNORECASE)

# New patterns to remove content inside <GithubCodeSegment> and <CodeGroup> tags
github_code_segment_pattern = re.compile(r'<GithubCodeSegment[\s\S]*?</GithubCodeSegment>', re.IGNORECASE)
Expand All @@ -35,18 +36,13 @@ def extract_text_from_mdx(file_path):
with open(file_path, 'r') as file:
content = file.read()

# Remove content inside <GithubCodeSegment> and <CodeGroup> tags
# Remove ignored components
content = github_code_segment_pattern.sub('', content)
content = code_group_pattern.sub('', content)

# Remove import statements
content = api_endpoint_pattern.sub('', content) # Ignore ApiEndpointRequestResponse blocks
content = import_pattern.sub('', content)

# Remove paths and GuideBox components
content = path_pattern.sub('', content)
content = guidebox_pattern.sub('', content)

# Remove JSX components and JSX-like tags
content = jsx_like_tags_pattern.sub('', content)

# Initialize the Markdown parser
Expand Down Expand Up @@ -142,4 +138,4 @@ def check_directory(directory):
has_errors = check_directory(directory_path)

# Return False if errors were found
sys.exit(1 if has_errors else 0)
sys.exit(1 if has_errors else 0)
Loading

0 comments on commit 5eb5c7f

Please sign in to comment.