Git Product home page Git Product logo

weex-markdown's Introduction

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

weex-markdown's People

Contributors

hanks10100 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.