Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: markdown parsing after marked library version dump #542

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev-portal/src/components/SwaggerUiLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, { useMemo } from 'react'
import { Button, Header, Image, Container } from 'semantic-ui-react'

// markdown for external docs description
import marked from 'marked'
import { marked } from 'marked'
import DOMPurify from 'dompurify'

// services
Expand All @@ -24,7 +24,7 @@ import { store } from 'services/state.js'
export const SwaggerLayoutPlugin = () => ({ components: { InfoContainer: InfoReplacement } })

function Markdown ({ source }) {
const rendered = useMemo(() => DOMPurify.sanitize(marked(source, {
const rendered = useMemo(() => DOMPurify.sanitize(marked.parse(source, {
headerIds: false,
silent: true
})), [source])
Expand Down
4 changes: 2 additions & 2 deletions dev-portal/src/services/get-fragments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { observable } from 'mobx'

// markdown parsing
import frontmatter from 'front-matter'
import marked from 'marked'
import { marked } from 'marked'

export const fragments = observable({})

Expand All @@ -39,7 +39,7 @@ function loadHtml (path, fragment) {

window.fetch(path).then(response => response.text().then(text => {
const parsedMarkdown = frontmatter(text)
const html = marked(parsedMarkdown.body, {
const html = marked.parse(parsedMarkdown.body, {
headerPrefix: 'header-',
silent: true
})
Expand Down