Skip to content

Commit

Permalink
Initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye64 committed Mar 31, 2019
1 parent f0ff62e commit 413d6e4
Show file tree
Hide file tree
Showing 13 changed files with 2,423 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
55 changes: 55 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module.exports = {
root: true,

parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},

env: {
browser: true
},

extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
'@vue/standard'
],

// required to lint *.vue files
plugins: [
'vue'
],

globals: {
'ga': true, // Google Analytics
'cordova': true,
'__statics': true,
'process': true
},

// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow paren-less arrow functions
'arrow-parens': 'off',
'one-var': 'off',

'import/first': 'off',
'import/named': 'error',
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'prefer-promise-reject-errors': 'off',

// allow console.log during development only
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
QMarkdown (@quasar/qmarkdown)
===

![official icon](https://img.shields.io/badge/Quasar%201.0-Official%20UI%20App%20Extension-blue.svg)
![npm (scoped)](https://img.shields.io/npm/v/@quasar/quasar-app-extension-qmarkdown.svg?style=plastic)
[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/quasarframework/app-extension-qmarkdown.svg)]()
[![GitHub repo size in bytes](https://img.shields.io/github/repo-size/quasarframework/app-extension-qmarkdown.svg)]()
[![npm](https://img.shields.io/npm/dt/@quasar/quasar-app-extension-qmarkdown.svg)](https://www.npmjs.com/package/@quasar/quasar-app-extension-qmarkdown)

QMarkdown is an `UI App Extension` for [Quasar Framework v1](https://v1.quasar-framework.org/). It will not work with legacy versions of Quasar Framework.

This work is currently in `beta` and there are expected changes while things get worked out. Your help with testing is greatly appreciated.

# Info
QMarkdown allows you to have markdown in your web pages. You can either use the standard default slot or use the property `src` to define your markdown.

# Install
To add this App Extension to your Quasar application, run the following (in your Quasar app folder):
```
quasar ext add @quasar/qmarkdown
```

# Uninstall
To remove this App Extension from your Quasar application, run the following (in your Quasar app folder):
```
quasar ext remove @quasar/qmarkdown
```

# Describe
You can use `quasar describe QMarkdown`

# Test Project
Can be found [here](https://github.com/hawkeye64/quasar-app-extension-qmarkdown).

# Demo
Can be found [here](https://qmarkdown.netlify.com/#/).

# Example Code
Be sure to check out the Test Project for more examples.
```
<q-markdown>
Classic markup: :wink: :joy: :cry: :angel: :heart: :beers: :laughing: :yum:
Shortcuts (emoticons): :-) :-( 8-) ;)
</q-markdown>
```

# QMarkdown Vue Properties
| Vue&nbsp;Property | Type | Description |
|---|---|---|
| src | String | Pass the markdown as a string instead of a slot |
| toc | Boolean | Generate a TOC; received with `toc` event |
| toc-start | Number | [1-5] The number defines the starting header (ex: 1 == h1, 2 == h2, etc) |
| toc-end | Number | [2-6] The number defines the ending header (ex: 3 == h3, 4 == h4, etc). This number must be greater than the `startingToc` property or it will be ignored |
| task-lists-enable | Boolean | set to true to enable task lists checkboxes (not read-only) |
| task-lists-label | Boolean | to wrap the rendered list items in a <label> element for UX purposes |
| task-lists-enable-after | Boolean | to add the label after the checkbox |

# QMarkdown Vue Events
| Vue&nbsp;Event | Description |
|---|---|
| toc | If the `toc` proerty is set to `true`, this event will occur containing any TOC data, if there is any |

Given markdown that looks like this:
```
# h1 Heading 8-)
## h2 Heading
### h3 Heading
```

The TOC data looks like this:
```
[
{id:`h2-Heading`,title:`h2 Heading`},
{id:`h3-Heading`,title:`h3 Heading`, sub: true}
]
```


# QMarkdown Vue Slots
| Vue&nbsp;Property | Description |
|---|---|
| default | The default slot - this slot overrides anything that may be passed in via the `src` property. |
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "@quasar/quasar-app-extension-qmarkdown",
"version": "1.0.0-alpha.1",
"description": "A Quasar UI Extension to display inline markdown",
"author": "Hawkeye64 <[email protected]>",
"main": "src/index.js",
"scripts": {
"lint": "eslint --ext .js,.vue src",
"lint-fix": "eslint --ext .js,.vue src --fix",
"test": "echo \"No test specified\" && exit 0"
},
"engines": {
"node": ">= 8.9.0",
"npm": ">= 5.6.0",
"yarn": ">= 1.6.0"
},
"publishConfig": {
"access": "public"
},
"bugs": "https://github.com/quasarframework/app-extension-qmarkdown/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/quasarframework/app-extension-qmarkdown.git"
},
"homepage": "https://github.com/quasarframework/app-extension-qmarkdown",
"license": "MIT",
"keywords": [
"quasar",
"app",
"app extension",
"extension",
"markdown"
],
"dependencies": {
"markdown-it": "^8.4.2",
"markdown-it-abbr": "^1.0.4",
"markdown-it-container": "^2.0.0",
"markdown-it-deflist": "^2.0.3",
"markdown-it-emoji": "^1.4.0",
"markdown-it-footnote": "^3.0.1",
"markdown-it-imsize": "^2.0.1",
"markdown-it-ins": "^2.0.0",
"markdown-it-katex": "^2.0.3",
"markdown-it-mark": "^2.0.0",
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"markdown-it-task-lists": "^2.1.1",
"markdown-it-toc-and-anchor": "^4.2.0",
"prismjs": "^1.16.0"
},
"devDependencies": {
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.15.2",
"eslint-loader": "^2.1.2",
"eslint-plugin-vue": "^5.2.2"
}
}
5 changes: 5 additions & 0 deletions src/boot/qmarkdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import QMarkdown from '@quasar/quasar-app-extension-qmarkdown/src/component/QMarkdown'

export default async ({ Vue }) => {
Vue.component('q-markdown', QMarkdown)
}
Loading

0 comments on commit 413d6e4

Please sign in to comment.