GithubHelp home page GithubHelp logo

tylingsoft / markdown-core Goto Github PK

View Code? Open in Web Editor NEW
35.0 6.0 7.0 12.38 MB

An extensible markdown engine which powers Markdown Plus.

CSS 15.05% JavaScript 81.31% HTML 3.64%
markdown markdown-plus markdown-core mdc

markdown-core's Introduction

Markdown Core

Code Climate

An extensible markdown engine used in the Markdown Plus project.

Installation

yarn add markdown-core

Usage

Node.js

import mdc from 'markdown-core'

mdc.render('# hello world')

Browser

Please refer to the example.

Development

Build

yarn build:watch

Verify

Host and open build/index.html in browser

License

MIT


Test

  1. Manually review build/index.html in browser, make sure it look good and everything is fine.
  2. In test/index.js set const init = true.
  3. Run yarn test to generate fixtures in test/fixtures.
  4. In test/index.js set const init = false.
  5. Do development, change code.
  6. Run yarn test to make sure nothing breaks.

Todo

  • PPT
  • Create a website for this project
    • GitHub pages
  • mdc.xxx => xxx
  • Support mermaid git graph
  • Replace mocha with jest

markdown-core's People

Contributors

tylerlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

markdown-core's Issues

mermaid is not rendered

Hello,

Rendering works very well but is seems that mermaid graphs are not rendered when used with nodejs

import mdc from 'markdown-core';
var test=mdc.render('# hello word');
console.log(test);

Outputs:

<h1 id="hello-word" data-source-line="1"><a class="anchor" href="#hello-word"><span class="octicon octicon-link"></span></a>hello word</h1>

But

import mdc from 'markdown-core';
var test=mdc.render('```mermaid\ngraph TD;\nA-->B;\nA-->C;\nB-->D;\nC-->D;\n```');
console.log(test);

Outputs:

<div class="mermaid">graph TD;
A-->B;
A-->C;
B-->D;
C-->D;</div>

Weirdly, when the mermaid syntax has an error, the error shows correctly the same way it is in the mermaid live editor:

<pre>Parse error on line 1:
graph TDx;A-->B;A-->C;B
------^
Expecting 'DIR', 'TAGEND', 'TAGSTART', 'UP', 'DOWN', got 'ALPHA'</pre>

running provided example nothing happens, get errors

When I upload provided example to my host and run it, first I get an error in console about

index.bundle.js not being loaded since it can't be found. This file is refered to in index.html

<script src="index.bundle.js"></script>

When I comment this out, no errors are produced anymore, but also nothing happens, emtpy page.

I tried adding this code:

var mdc = require('markdown-core/markdown-core-node');
var markdown = '# your markdown here';
var html = mdc.render(markdown);
$('.markdown-body').html(html);

and I get
Uncaught ReferenceError: require is not defined

How can I test the provided example?

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.