Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
Add renderer for Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Muller committed Sep 23, 2021
1 parent 332fea3 commit d49fa25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/LSInline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getInlineContent, getInlineType, isInlineContainer } from '../utils'
import LSBlockReference from './LSBlockReference'
import LSInlines from './LSInlines'
import LSLink from './LSLink'
import LSTag from './LSTag'
import LSSrc from './LSSrc'
import LSTable from './LSTable'

Expand Down Expand Up @@ -31,6 +32,7 @@ function Emphasis({ c }) {
const INLINE_RENDERERS = {
Plain,
Link: LSLink,
Tag: LSTag,
Block_reference: LSBlockReference,
Code,
Src: LSSrc,
Expand Down
15 changes: 15 additions & 0 deletions src/components/LSTag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { pageNames } from '../utils'
import PageLink from './PageLink'

export default function LSTag({ c }) {
const tag = c[0]
const tagType = tag[0]
if (tagType === 'Plain') {
const toPage = c[0][1]
if (pageNames.includes(toPage)) {
return <PageLink pageName={toPage} />
} else {
return toPage
}
}
}

0 comments on commit d49fa25

Please sign in to comment.