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

Tag renderer #6

Open
wants to merge 2 commits into
base: master
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
9 changes: 2 additions & 7 deletions data.json
Original file line number Diff line number Diff line change
Expand Up @@ -35538,13 +35538,8 @@
"children": [],
"title": [
[
"Link",
{
"url": ["Search", "Videos"],
"label": [["Plain", ""]],
"full_text": "[[Videos]]",
"metadata": ""
}
"Tag",
[["Plain", "Videos"]]
]
],
"body": [],
Expand Down
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
}
}
}