Code Monkey home page Code Monkey logo

downshow's People

Contributors

acornejo avatar anton164 avatar rasmusvhansen avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

downshow's Issues

Escaping HTML encoding

Blockquotes which need to be rendered as > in markdown are sometimes parsed as >.

The HTML I used is The actual lecture starts at 6:00 minutes.<div><br><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><span style="font-family: georgia;">Q A session begins at 38:20 minutes.</span></div><div><br></div></blockquote></div> and it converts to markdown as:

The actual lecture starts at 6:00 minutes.

&gt; Q A session begins at 38:20 minutes.

This is probably because you need to escape the HTML entities, like :

https://code.google.com/p/jslibs/wiki/JavascriptTips#Escape_and_unescape_HTML_entities

Just so you know, I tried to pass > as &#62; so that it will be escaped as unicode characters. Unfortunately that did not fix the problem.

IMG Relative Paths are converted to absolute

Since .src on an IMG node always returns the full path of the src attribute, downshow converts relative paths to absolute paths (in the following line):

var src = node.src ? nltrim(node.src) : '', alt = node.alt ? nltrim(node.alt) : '', caption = node.title ? nltrim(node.title) : '';

So <img src="/img-path.jpg" alt="img"> would become ![img](http://example.com/img-path.jpg)
I assume that's not the intended behaviour, I'll submit a pull request shortly :-)

Nested Lists are broken

Nested lists are not processed properly. I had a first order nested list:

  • Enzymes control all metabolic processes in the body.
  • Factors which affect enzyme activity and therefore optimal metabolic efficiency:
    • Temperature: as the temperature rises enzymes work faster until their optimum temperature (what they work best at). In human this is 370C (body temp.)
    • pH: most enzymes optimum is at pH 7, though it varies.
    • Concentration of enzyme and substrate: the rate of reaction is directly proportionate to the amount of enzyme.

and got the output:

- Enzymes control all metabolic
    processes in the body.

- Factors which affect enzyme
    activity and therefore optimal metabolic efficiency:

        - Temperature: as the
        temperature rises enzymes work faster until their optimum
        temperature (what they work best at). In human this is 37 0 C
        (body temp.)

 - pH: most enzymes optimum is at
        pH 7, though it varies.

 - Concentration of enzyme and
        substrate: the rate of reaction is directly proportionate to the
        amount of enzyme.

The third list element gets processed as a pre when converting back to HTML.

Also, the input:

  1. Order one
  2. Order 1, el 2
    1. Order 2 el 1
    2. Order 2 el 2
      1. Order 3 el 1
      2. Order 3 El 2
        1. Order 4 el 1

converts it to:

1. Order one &amp;lt;br&amp;gt;
1. Order 1, el 2 
 1. Order 2 el 1
 1. Order 2 el 2 
 1. Order 3 el 1
 1. Order 3 El 2 
 1. Order 4 el 1

It does not process second order (or higher) nesting.

BTW, I came across this library when searching for "reverse breadth first" as I was trying to solve the Nested lists issue using a similar approach. It works well for almost all the other markdown spec, but lists (nested) did not cut it. Great work for not using regex which does not do a proper job when encountering unknown tags.

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.