weex-markdown
Weex markdown component
Last updated 2 years ago by hanks .
Apache-2.0 · Original npm · Tarball · package.json
$ cnpm install weex-markdown 
SYNC missed versions from official npm registry.

Weex Markdown Component

A Vue.js component to parse and render markdown text into native components on Weex platform.

Properties

  • content: markdown text content.
  • theme: mardown style theme.

Usage

Raw text content

You can write markdown text inside it directly.

<markdown>
# This is a Big Title

**something inside.**

by [Hanks](https://github.com/hanks10100).
</markdown>

Notice: The indent will break the markdown syntax rules.

<div>
  <markdown>
    # Invalid Title

    *Emphasis* stil **works**.
  </markdown>
</div>

Use content property

<markdown content="This _text_ *will be __rendered__ too*.">

You can also binding the content with a javascript variable:

<markdown v-bind:content="article">

The article may defined like this:

new Vue({
  data () {
    return {
      article: '# Title\n\nFirst paragraph.'
    }
  }
})

Custom styles

If passed theme property, the new styles will override the default theme.

new Vue({
  template: `
    <markdown :theme="newTheme"></markdown>
  `,
  data () {
    return {
      newTheme: {
        h1: {
          color: '#FF6600',
          fontWeight: 'bold'
        }
      }
    }
  }
})

Default Theme

See src/markdown.js.

Syntax Cheetsheet

Headers

# H1
## H2
### H3
#### H4
##### H5
###### H6

Inline Text

  • Emphasis: use *asterisks* or _underscores_.
  • Strong emphasis: use two **asterisks** or __underscores__.
  • Strikethrough: uses two ~~tildes~~.
  • codespan: use back-ticks around.

Links

[link name](http://whatever.link.address)

Not support reference links and relative paths.

Images

![image alt](http://image.address/whatever.png)

Not support reference image sources and relative paths.

Image size

In Weex, images must set width and height, otherwise it will not render.

The size of the image can be declared in {} within image alt:

![image alt {750x640}](http://image.address/whatever.png)
  • {500x400} means width is 500px and height is 400px.
  • {480x} means both width and height are 480px.
  • {640} is invalid.

Blockquotes

Use > before blockquote texts.

> Use `>` before blockquote texts.

Unsupported Syntax

  • [ ] Lists
  • [ ] Code blocks
  • [ ] Tables
  • [ ] Inline HTML

Current Tags

  • 0.2.0                                ...           latest (2 years ago)

7 Versions

  • 0.2.0                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 9
Last Day 0
Last Week 8
Last Month 1
Dependencies (10)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |