Skip to content

Commit

Permalink
Merge branch 'main' into not-abram/citation-button
Browse files Browse the repository at this point in the history
  • Loading branch information
Not-Abram committed Sep 24, 2024
2 parents a7f01be + 3eefb29 commit bf9ed8a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/viewer/src/components/Properties/Show.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Property } from '@/models'
import { Aliases, Link, References, Tabs, Typeset } from '../Shared'
import { Aliases, Link, References, Source, Tabs, Typeset } from '../Shared'
import Spaces from './Spaces.svelte'
import Theorems from './Theorems.svelte'
Expand All @@ -24,6 +24,10 @@
<Typeset body={property.description} />
</section>

<section class="description-markdown">
<Source source={property.description} />
</section>

<Tabs {tabs} {tab} {rel} />

{#if tab === 'spaces'}
Expand Down
16 changes: 16 additions & 0 deletions packages/viewer/src/components/Shared/Source.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts">
export let source: string
let showMarkdown = false
</script>

<button
class="btn btn-sm mb-3 {showMarkdown
? 'btn-secondary'
: 'btn-outline-secondary'}"
on:click={_ => (showMarkdown = !showMarkdown)}
>
{#if showMarkdown}Hide{:else}Show{/if} markdown
</button>
{#if showMarkdown}
<pre>{source}</pre>
{/if}
1 change: 1 addition & 0 deletions packages/viewer/src/components/Shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export { default as Link } from './Link'
export { default as Loading } from './Loading.svelte'
export { default as NotFound } from './NotFound.svelte'
export { default as References } from './References.svelte'
export { default as Source } from './Source.svelte'
export { default as Tabs } from './Tabs.svelte'
export { default as Title } from './Title.svelte'
export { default as Typeset } from './Typeset.svelte'
10 changes: 9 additions & 1 deletion packages/viewer/src/components/Spaces/Show.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script lang="ts">
import type { Space } from 'src/models'
import { Aliases, Link, References, Tabs, Typeset } from '../Shared'
import { Aliases, Link, References, Source, Tabs, Typeset } from '../Shared'
import Counterexamples from './Counterexamples.svelte'
import Properties from './Properties.svelte'
export let space: Space
export let tab: 'properties' | 'theorems' | 'references'
export let rel: string | undefined = undefined
let showMarkdown = false
const tabs = ['properties', 'theorems', 'references'] as const
</script>

Expand All @@ -24,6 +26,10 @@
<Typeset body={space.description} />
</section>

<section class="description-markdown">
<Source source={space.description} />
</section>

<Tabs {tabs} {tab} {rel} />

{#if tab === 'properties'}
Expand All @@ -32,4 +38,6 @@
<Counterexamples {space} />
{:else if tab === 'references'}
<References references={space.refs} />
{:else if tab === 'markdown'}
<pre>{space.description}</pre>
{/if}
6 changes: 5 additions & 1 deletion packages/viewer/src/components/Theorems/Show.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Theorem } from 'src/models'
import { Link, References, Tabs, Title, Typeset } from '../Shared'
import { Link, References, Tabs, Source, Typeset } from '../Shared'
import Name from './Name.svelte'
import Converse from './Converse.svelte'
Expand All @@ -21,6 +21,10 @@
<Typeset body={theorem.description} />
</section>

<section class="description-markdown">
<Source source={theorem.description} />
</section>

<Tabs {tabs} {tab} {rel} />

{#if tab === 'converse'}
Expand Down

0 comments on commit bf9ed8a

Please sign in to comment.