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

Feature: PMarkdownRenderer #637

Merged
merged 72 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
408bbf0
Scaffold new PMarkdownRenderer compoentn
znicholasbrown Feb 2, 2023
32043a6
Add PMarkdownRenderer to global export bucket
znicholasbrown Feb 2, 2023
fc8f781
Add a basic service worker code snippet and worker
znicholasbrown Feb 3, 2023
8528b33
Add markdown-it
znicholasbrown Feb 3, 2023
433113e
Remove markdown-it
znicholasbrown Feb 3, 2023
ec4ee82
Add marked types
znicholasbrown Feb 3, 2023
57c019f
Scaffold a basic parse + render pattern
znicholasbrown Feb 3, 2023
be4118d
Add demo
znicholasbrown Feb 3, 2023
3bf8d47
Lint MarkdownRenderer demo component
znicholasbrown Feb 3, 2023
5c67258
Fix bad types, use component :is syntax
znicholasbrown Feb 3, 2023
e872092
Improve the demo; rendering works in more complex scenarios
znicholasbrown Feb 3, 2023
a132c90
Add some more examples to the documentation
znicholasbrown Feb 3, 2023
a9c10c3
Add some basic style resets, fix overflow in raw view
znicholasbrown Feb 3, 2023
847309d
Update demo description
znicholasbrown Feb 3, 2023
22f36fe
Update default
znicholasbrown Feb 3, 2023
f46c765
Add code highlighting and saner code blocks
znicholasbrown Feb 3, 2023
9f41bf5
Normalize link hrefs
znicholasbrown Feb 3, 2023
f355073
Demo should use relative links
znicholasbrown Feb 3, 2023
bf00dbd
Add support for lists
znicholasbrown Feb 3, 2023
4bc8f07
Improve space and emphasis rendering
znicholasbrown Feb 3, 2023
aa57a2f
Unescape html entities
znicholasbrown Feb 3, 2023
2a5aa57
Fix inline emphasized and strong elements
znicholasbrown Feb 3, 2023
3662610
Add dompurify
znicholasbrown Feb 3, 2023
daca0a0
Improve how headings are handled
znicholasbrown Feb 4, 2023
9c7e44b
Merge branch 'main' into feature-markdown-render-2023-01-02
znicholasbrown Feb 5, 2023
8b8a698
Downgrade to v4.2.2 because of https://github.com/markedjs/marked/iss…
znicholasbrown Feb 5, 2023
cf095f7
Make headings more consistent
znicholasbrown Feb 5, 2023
6a8afdb
Improve type safety of markdown work - add new worker message types
znicholasbrown Feb 5, 2023
0827cde
Worker should only accept one type of message - sanitize will happen …
znicholasbrown Feb 5, 2023
bb36ae5
Remove sanitization from the worker - it can't run in a node environm…
znicholasbrown Feb 5, 2023
8298d3e
Improve sanitized html support
znicholasbrown Feb 5, 2023
01fe8ca
Add PHtml component
znicholasbrown Feb 5, 2023
d3200af
Wrap PHtml in a span
znicholasbrown Feb 5, 2023
e1a8f54
Merge branch 'main' into feature-markdown-render-2023-01-02
znicholasbrown Feb 8, 2023
2b150ea
Add better demo cases
znicholasbrown Feb 8, 2023
070bb27
Add del support
znicholasbrown Feb 8, 2023
03397f2
Extend language alias support
znicholasbrown Feb 8, 2023
5fd8078
Add gh-markdown
znicholasbrown Feb 8, 2023
9bf566a
Remove explicit xml support (it's implied from HTML support)
znicholasbrown Feb 8, 2023
bfd0305
Add PHashLink component
znicholasbrown Feb 8, 2023
91a0117
Simplifiy PHashLink
znicholasbrown Feb 8, 2023
592b462
Add task list demo
znicholasbrown Feb 8, 2023
fedc04b
Fix code blocks escaping html
znicholasbrown Feb 8, 2023
e5a73ac
Small spacing tweaks
znicholasbrown Feb 8, 2023
f31ab63
Add highlight code block demo
znicholasbrown Feb 8, 2023
11f143f
Add basic PTable support
znicholasbrown Feb 8, 2023
cc51f56
Add fully-slotted PTable support
znicholasbrown Feb 8, 2023
205d89c
Add table demo to blockquote section
znicholasbrown Feb 8, 2023
89dc2d4
Fix blockquote nested tables and codeblock font style
znicholasbrown Feb 8, 2023
317b070
Give reset class higher specificity
znicholasbrown Feb 8, 2023
d3e05f6
Add html rendering sections
znicholasbrown Feb 8, 2023
d8bcd56
Make table headers sticky
znicholasbrown Feb 9, 2023
0f6d7f3
Fix an issue where empty table cells would render tokens as raw text
znicholasbrown Feb 9, 2023
48cb2d8
Remove unused args/comments
znicholasbrown Feb 9, 2023
aed6480
Merge branch 'main' into feature-markdown-render-2023-01-02
znicholasbrown Feb 9, 2023
4fdab7e
Update netlify toml, headers should be sticky
znicholasbrown Feb 9, 2023
7bdac34
Add image src csp
znicholasbrown Feb 9, 2023
900a0ef
Just allow any https: image
znicholasbrown Feb 9, 2023
9a14960
Fix an issue creating tables with null text
znicholasbrown Feb 9, 2023
c9de6a7
Default to unwrapped demos
znicholasbrown Feb 9, 2023
f47ec79
Remove hash link, update component page
znicholasbrown Feb 9, 2023
fbcde11
PHtml => PSanitizeHtml
znicholasbrown Feb 9, 2023
1dcba7e
Update p-html class name => p-sanitize-html
znicholasbrown Feb 9, 2023
56a5288
Remove sticky headers comment
znicholasbrown Feb 9, 2023
40efb8b
Remove Worker type
znicholasbrown Feb 9, 2023
8e30721
Don't pre-create message payload
znicholasbrown Feb 9, 2023
1a537e3
Move parser checks to typeguards
znicholasbrown Feb 9, 2023
3b0eec9
Abstract child token mapping to its own method
znicholasbrown Feb 9, 2023
bea6f7f
Remove inferred type
znicholasbrown Feb 9, 2023
daac05c
Merge branch 'main' into feature-markdown-render-2023-01-02
zhen0 Feb 10, 2023
c8e5892
Remove unused import
znicholasbrown Feb 13, 2023
5ec4385
Prefer unknown types
znicholasbrown Feb 13, 2023
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
14 changes: 14 additions & 0 deletions .vscode/typescript.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Web worker": {
"prefix": "worker",
"body": [
"const handleMessage = (message: MessageEvent<unknown>): void => {",
" self.postMessage(message)",
"}",
"",
"self.onmessage = handleMessage",
"export default {}"
],
"description": "Creates a basic web worker with snippets for receiving and posting messages to the main thread."
}
}
2 changes: 1 addition & 1 deletion demo/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PGlobalSidebar>
</template>
<ContextSidebar v-if="showMenu" class="app__sidebar" />
<router-view class="w-full mx-auto py-10 px-6 lg:px-8" />
<router-view class="w-full" />
</div>
</template>

Expand Down
53 changes: 43 additions & 10 deletions demo/components/ComponentPage.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div class="component-page">
<!-- make sticky header -->
<div class="component-page__heading">
<HashLink>{{ title }}</HashLink>
<p-hash-link class="component-page__heading-link" :hash="title">
{{ title }}
</p-hash-link>
<p-link to="https://www.prefect.io/">
Documentation
</p-link>
Expand All @@ -20,19 +21,27 @@
<div class="component-page__demos">
<template v-for="demo in validDemosArray" :key="demo.title">
<div class="component-page__demo">
<HashLink v-if="demo.slotKey && validDemosArray.length > 1" :hash="demo.slotKey">
<p-hash-link v-if="demo.slotKey && validDemosArray.length > 1" class="component-page__heading-link" :hash="demo.slotKey">
{{ demo.title }}
</HashLink>
</p-hash-link>

<template v-if="demo.description">
<div class="component-page__demo-description">
{{ demo.description }}
</div>
</template>

<ResizableSection>
<slot :name="demo.slotKey" />
</ResizableSection>
<template v-if="useResizable">
<ResizableSection>
<slot :name="demo.slotKey" />
</ResizableSection>
</template>

<template v-else>
<p-card class="component-page__demo-card">
<slot :name="demo.slotKey" />
</p-card>
</template>
</div>
</template>
</div>
Expand Down Expand Up @@ -63,7 +72,6 @@
import { asArray, kebabCase } from '@/utilities'
import { computed, useSlots } from 'vue'
import { useRoute } from 'vue-router'
import HashLink from '@/demo/components/HashLink.vue'
import ResizableSection from '@/demo/components/ResizableSection.vue'
import { getRouteRecordIndex, routeRecordsFlat } from '@/demo/router/routeRecordsFlat'

Expand All @@ -76,6 +84,7 @@
title: string,
description?: string,
demos?: DemoSection | DemoSection[],
useResizable?: boolean,
}>()

const slots = useSlots()
Expand Down Expand Up @@ -108,15 +117,25 @@
<style>
.component-page { @apply
max-w-full
relative
}

.component-page__heading { @apply
flex
justify-between
text-sm
sticky
bg-background
dark:bg-background-400
top-16
lg:top-0
px-6
py-6
lg:px-8
z-10
}

.component-page__heading .hash-link { @apply
.component-page__heading .component-page__heading-link { @apply
text-2xl
}

Expand All @@ -125,7 +144,7 @@
text-lg
}

.component-page__demo .hash-link { @apply
.component-page__heading-link { @apply
text-base
}

Expand All @@ -148,6 +167,20 @@
text-sm
}

.component-page__demo,
.component-page__description,
.component-page__demo-description { @apply
max-w-full
mx-auto
py-6
px-6
lg:px-8
}

.component-page__demo-card { @apply
bg-transparent
}

.component-page__navigation { @apply
flex
justify-between
Expand Down
54 changes: 0 additions & 54 deletions demo/components/HashLink.vue

This file was deleted.

Loading