Skip to content

Conversation

MarBert
Copy link
Collaborator

@MarBert MarBert commented Sep 30, 2025

List of Changes

Fix the parsing for links in chatbot messages, update the markdown parsing to remove \ characters

Motivation and Context

How Has This Been Tested?

localhost

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link

changeset-bot bot commented Sep 30, 2025

🦋 Changeset detected

Latest commit: 82dc956

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
gitbook-docs Minor
nextjs-website Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 30, 2025

Jira Pull Request Link

This Pull Request refers to the following Jira issue CAI-558

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes parsing issues in chat messages and markdown documentation by addressing link formatting and special character handling. The changes improve how links are displayed in chat messages and resolve backslash character issues in markdown processing.

  • Enhanced chat message link parsing with better title resolution and formatting
  • Fixed markdown parsing to remove unwanted backslash characters
  • Added changeset documentation for version tracking

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
apps/nextjs-website/src/helpers/chatMessageParser.helper.ts Enhanced link parsing logic with title resolution from GitBook pages and anchor formatting
packages/gitbook-docs/src/scripts/parseDocUrlsAndIncludes.ts Added backslash character removal in markdown processing
.changeset/nice-ravens-mate.md Added changeset entry for version tracking

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

node.transformChildren(config)
const attrs = node.transformAttributes(config);
const gitBookPagesWithTitle: ReadonlyArray<PageTitlePath> =
config.variables ? [...config.variables.gitBookPagesWithTitle] : [];
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spread operator creates a new array unnecessarily. Since you're only reading from the array, you can use it directly: config.variables?.gitBookPagesWithTitle || []

Suggested change
config.variables ? [...config.variables.gitBookPagesWithTitle] : [];
config.variables?.gitBookPagesWithTitle || [];

Copilot uses AI. Check for mistakes.

Comment on lines +26 to +32
const titleFromPage =
childrenTreeNode &&
typeof childrenTreeNode[0] === 'string' &&
childrenTreeNode[0].endsWith('.md') &&
page
? page.title
: undefined;
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This complex conditional logic should be extracted into a helper function for better readability and testability. Consider creating a getTitleFromPage function.

Copilot uses AI. Check for mistakes.

Comment on lines +34 to +41
const titleFromAnchor =
childrenTreeNode &&
typeof childrenTreeNode[0] === 'string' &&
childrenTreeNode[0].startsWith('#')
? capitalizeFirstLetter(
childrenTreeNode[0].replace('#', '').replaceAll('-', ' ')
)
: undefined;
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Similar to the previous comment, this conditional logic should also be extracted into a helper function like getTitleFromAnchor for consistency and maintainability.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

This pull request is stale because it has been open for 14 days with no activity. If the pull request is still valid, please update it within 21 days to keep it open or merge it, otherwise it will be closed automatically.

@github-actions github-actions bot added the stale label Oct 15, 2025
import Markdoc, { Config, ConfigType, Node, Tag } from '@markdoc/markdoc';
import React, { ReactNode } from 'react';

import { PageTitlePath } from '@/helpers/parseS3Doc.helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { PageTitlePath } from '@/helpers/parseS3Doc.helpers';
import { PageTitlePath } from '@/helpers/parseS3Doc.helpers';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants