AlaskaAirlines / AuroDocsSite

Repository for the management of the Auro doc site
https://auro.alaskaair.com/
0 stars 0 forks source link

Update markdown render and parse external links #263 #264

Closed rmenner closed 2 weeks ago

rmenner commented 4 weeks ago

Alaska Airlines Pull Request

Type of change:

Please delete options that are not relevant.

Checklist:

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!
-- Auro Design System Team

Summary by Sourcery

Enhancements:

sourcery-ai[bot] commented 4 weeks ago

Reviewer's Guide by Sourcery

This PR refactors the markdown rendering functionality by introducing a new reusable RenderRemoteMarkdown component and updating the external link handling. The changes centralize markdown rendering logic, improve code reusability, and enhance the styling of external links.

Class diagram for RenderRemoteMarkdown component

classDiagram
    class RenderRemoteMarkdown {
        +useState()
        +useEffect()
        +fetchData()
        +ReactMarkdown
        +remarkGfm
        +remarkRehype
        +rehypeHighlight
        +rehypeExternalLinks
        +rehypeRaw
    }
    note for RenderRemoteMarkdown "This component fetches and renders markdown content from a URL."

Updated class diagram for AuroComponentContent

classDiagram
    class AuroComponentContent {
        -getMarkdownText()
        +componentDidMount()
        +RenderRemoteMarkdown
    }
    note for AuroComponentContent "Replaced getMarkdownText with RenderRemoteMarkdown for markdown rendering."

File-Level Changes

Change Details Files
Created a new reusable RenderRemoteMarkdown component for handling remote markdown content
  • Implemented a React functional component using hooks for fetching and rendering markdown
  • Added support for various markdown plugins including remarkGfm, rehypeHighlight, and rehypeExternalLinks
  • Centralized markdown rendering logic that was previously duplicated across multiple files
src/functions/renderRemoteMarkdown.js
Refactored external link handling in markdown content
  • Replaced custom external link renderer with rehypeExternalLinks plugin
  • Updated CSS styling for external link icons
  • Added base64 encoded SVG for external link icon
src/sass/markdown.scss
Updated all component files to use the new RenderRemoteMarkdown component
  • Removed duplicate getMarkdownText methods
  • Replaced dangerouslySetInnerHTML with RenderRemoteMarkdown component
  • Added rehypeExternalLinks plugin configuration to all markdown renderers
src/functions/renderComponentPage.js
src/functions/renderMarkdownPage.js
src/content/dynamic/_template/component.js
src/content/dynamic/contributing/contributing.js
src/content/dynamic/contributing/dod.js
src/content/dynamic/tokenlist/component.js

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
jason-capsule42 commented 3 weeks ago

Additional change request - make sure to update all dependencies