Skip to content

Commit

Permalink
feat: Init project
Browse files Browse the repository at this point in the history
  • Loading branch information
leo91000 committed May 14, 2022
0 parents commit 923b1f1
Show file tree
Hide file tree
Showing 19 changed files with 5,254 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist
node_modules
.output
.nuxt
pnpm-lock.yaml
renovate.json5
.github
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@antfu",
"rules": {
"vue/max-attributes-per-line": ["error", {
"singleline": {
"max": 2
}
}]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
*.log
.nuxt
nuxt.d.ts
.output
.env
.idea
dist
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
shamefully-hoist=true
strict-peer-dependencies=false
auto-install-peers=true
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Vue Tiptap Renderer

A Vue component to render JSON content generated by tiptap editor

## :heavy_check_mark: Supported features

- [x] Headings
- [x] Blockquote
- [x] Bullet list
- [x] Ordered list
- [x] Line feed
- [x] Images
- [x] Marks
- [x] Text styles
- [x] Text align
- [x] Font family (customisable class name)
- [x] Bold
- [x] Italic
- [x] Underline
- [x] Strike
- [x] Links

If any feature is missing a `console.warn` will pop. Do not hesitate to start a new issue to request missing feature.

## Usage

```shell
npm i @leo91000/vue-tiptap-renderer
# or
yarn add @leo91000/vue-tiptap-renderer
# or
pnpm add @leo91000/vue-tiptap-renderer
```

```vue
<script setup lang="ts">
// Optional : Import CSS Classes or provide your own
// You can also whitelist those tailwind css classes : italic line-through underline font-bold text-center text-justify text-left text-right font-bold
import '@leo91000/vue-tiptap-renderer/styles.css'
import type { JSONContent } from '@leo91000/vue-tiptap-renderer'
import { JsonRenderer } from '@leo91000/vue-tiptap-renderer'
defineProps<{
article: JSONContent
}>()
// Inject css class for font family text style
const fontFamilyClasses = {
'Roboto': 'font-roboto'
}
</script>
<template>
<JsonRenderer
:content="article"
:font-family-classes="fontFamilyClasses"
/>
</template>
```
22 changes: 22 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { copyFile } from 'fs/promises'
import { resolve } from 'path'
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
clean: true,
declaration: true,
rollup: {
emitCJS: true,
},
entries: [
{ input: 'src/index' },
],
externals: [
'vue-demi',
],
hooks: {
'build:done': async () => {
await copyFile(resolve(__dirname, 'style.css'), resolve(__dirname, 'dist/style.css'))
},
},
})
75 changes: 75 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "@leo91000/vue-tiptap-renderer",
"keywords": [
"tiptap",
"json",
"vue",
"render",
"function"
],
"license": "MIT",
"description": "Tiptap JSON content renderer for Vue 2/3",
"author": {
"name": "Léo Coletta",
"email": "[email protected]",
"url": "https://leo-coletta.fr"
},
"sideEffects": false,
"repository": "github:leo91000/vue-tiptap-renderer",
"homepage": "https://github.com/leo91000/vue-tiptap-renderer#readme",
"bugs": "https://github.com/leo91000/vue-tiptap-renderer/issues",
"funding": "https://github.com/leo91000",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "vitest",
"lint": "eslint --ext .ts .",
"prepack": "nr build",
"release": "nr test && standard-version && git push --follow-tags && nr publish",
"test": "nr lint && vitest run"
},
"version": "0.1.0",
"packageManager": "[email protected]",
"volta": {
"node": "16.15.0",
"npm": "8.10.0"
},
"dependencies": {
"vue-demi": "*"
},
"devDependencies": {
"@antfu/eslint-config": "0.23.1",
"@antfu/ni": "0.16.2",
"@vue/test-utils": "2.0.0-rc.21",
"eslint": "8.15.0",
"jsdom": "^19.0.0",
"standard-version": "9.3.2",
"typescript": "4.6.4",
"unbuild": "0.7.4",
"vitest": "0.12.6",
"vue": "3.2.33"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^2.0.0 || >=3.0.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
},
"vue": {
"optional": true
}
}
}
Loading

0 comments on commit 923b1f1

Please sign in to comment.