Skip to content

Commit

Permalink
fix review, remove ContentMarkdown component, move hljs to utils, add…
Browse files Browse the repository at this point in the history
… css file
  • Loading branch information
preschian committed Mar 24, 2022
1 parent dceee3b commit 0a0c690
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 77 deletions.
60 changes: 0 additions & 60 deletions components/ContentMarkdown.vue

This file was deleted.

24 changes: 21 additions & 3 deletions pages/contribute.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
<template>
<ContentMarkdown type="contribute" />
<section class="content">
<VueMarkdown :source="content" :options="options" />
</section>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import highlight from '~/utils/highlight'
import '@/styles/content-markdown.scss'
import Contributing from '../CONTRIBUTING.md'
@Component({
components: {
ContentMarkdown: () => import('@/components/ContentMarkdown.vue'),
VueMarkdown: () => import('vue-markdown-render'),
},
data() {
return {
options: {
highlight,
},
}
},
})
export default class Contribute extends Vue {}
export default class Contribute extends Vue {
get content() {
return Contributing
}
}
</script>
32 changes: 32 additions & 0 deletions pages/first-time.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<section class="content">
<VueMarkdown :source="content" :options="options" />
</section>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import highlight from '~/utils/highlight'
import '@/styles/content-markdown.scss'
import FirstTimeMD from '../FIRST_TIME.md'
@Component({
components: {
VueMarkdown: () => import('vue-markdown-render'),
},
data() {
return {
options: {
highlight,
},
}
},
})
export default class FirstTime extends Vue {
get content() {
return FirstTimeMD
}
}
</script>
14 changes: 0 additions & 14 deletions pages/first_time.vue

This file was deleted.

10 changes: 10 additions & 0 deletions styles/content-markdown.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import '~/node_modules/highlight.js/styles/github-dark.css';

.content {
pre,
blockquote {
background-color: black;
border-left: 5px solid #dbdbdb;
padding: 1.25em 1.5em;
}
}
14 changes: 14 additions & 0 deletions utils/highlight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import hljs from 'highlight.js'

const highlight = function (str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(str, { language: lang }).value
} catch (__) {
return ''
}
}
return ''
}

export default highlight

0 comments on commit 0a0c690

Please sign in to comment.