PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

Strip markdown syntax from frontmatter

Open
#908 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

Describe the bug

When rendering a DocCard, the frontmatter description is used - https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx#L80-L86

This plugin currently puts markdown into the frontmatter, the DocCard component does not transform markdown to HTML so markdown syntax is rendered.

Expected behavior

Frontmatter is not generated with markdown syntax

frontmatter: Endpoint used to get a Profile

Current behavior

Frontmatter has markdown in it

frontmatter: Endpoint used to get a [Profile](./path/to/profile)

Possible solution

None

This splitDescription method is used throughout createItems. I guess stripping with something like this might work

Steps to reproduce

  1. Clone https://github.com/omonk/spec-render-bug
  2. git checkout frontmatter-markdown
  3. http://localhost:3002/docs/test-spec/update
  4. See DocCard is rendered with get description

Screenshots

image image

Context

It looks unprofessional

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with splitDescription in packages/docusaurus-plugin-openapi-docs/src/openapi/openapi.ts and trace how createItems places its result into frontmatter; the DocCard reference in packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx shows why raw markdown is exposed. Reproduce the issue with the linked spec-render-bug steps, then verify that generated descriptions contain plain text such as “Endpoint used to get a Profile” rather than markdown links.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.