Comments (10)
Hmmm good question...
The output is less than ideal, and I can't think of any reason when you'd want a literal \r in the output like that, so I think it is something this module should be dealing with.
from markdown-js.
Any news regarding this?
from markdown-js.
Also having this issue.
I should mention using Unix-style line breaks in my editor does solve the problem.
from markdown-js.
I am using it as a nodejs module in order to render blogposts edited in browser. So I have no means (I know of) to change the line break style. In the mean time, I'm replacing \r
before rendereing.
from markdown-js.
I can't break any line if I use CRLF... I found that with LF and 3 trailing spaces, line breaks work fine. This happens with h5ai which is using markdown-js.
from markdown-js.
Workaround While My Solution is Ignored
I've submitted a patch which fixes this issue but the pull request has been ignored for over a month now. To implement a filter for the markdown you want to parse just do
var input = "# Heading\r\n\r\nParagraph";
// All line endings are converted to `\n` so the issue should not affect you anymore.
input = input.replace(/(\r\n|\n|\r)/g, '\n');
// input is now equal to: "# Heading\n\nParagraph"
var output = require( "markdown" ).markdown.toHTML( input );
print( output );
The real issue occurs in the Markdown.prototype.split_blocks
function defined in lib/markdown.js
. That function depends on line endings always being \n
and proceeds without warning when other line ending styles are used. Later in the process \r
causes issues with parsing and you end up with unexpected results. There should be explicit instructions stating that users are responsible for converting line endings prior to running markdown on their source or, an explicit notification that all line endings will be converted to \n
, if my pull request is used.
Reference pull request #64
from markdown-js.
Fixed by 67d8fee.
from markdown-js.
I encountered this same problem today while working on a blogging engine. To fix it I used the commend below:
dos2unix postsdirectory/*.md
from markdown-js.
Hi @qawemlilo. Do you still get the error with the latest code from Github, or is that using 0.4.0? It should be fixed in HEAD now, so if it's not I'd love to know.
from markdown-js.
Hi @evilstreak, you are right I'm using the npm version which is still on 0.4.0, will fork the latest. This is an awesome project by the way.
from markdown-js.
Related Issues (20)
- Link to `lib/markdown.js` not working in readme HOT 1
- Strikethrough component doesn't work. HOT 1
- Code Syntax Highlight
- Unable to resolve module `../../constants/index` from `D:\GitHub\medred\app\src\ stories\screens\Specialty\index.js`: could not resolve `D:\GitHub\medred\app\src \stories\constants\index' as a folder: it did not contain a package, nor an inde x file
- Can't distinguish code language HOT 1
- support parase "[TOC]"? HOT 1
- [BUG] href not correctly parsed when text and its url both contains underscore. HOT 3
- *** Text *** parse was strong , but Italic not effective HOT 1
- Two links following one another
- Add note to README that this repo is not maintained HOT 2
- The speed of the Markdown-js is too bad. HOT 2
- Load external Markdown File in html.
- Inline HTML is escaped? HOT 2
- Vulnerability issue HOT 2
- 🚨 Potential Security Vulnerability HOT 1
- Trying to get in touch regarding a security issue HOT 1
- Images not getting converted properly in certain cases
- (wrong repository) HOT 1
- the "table" cannot use HOT 4
- how to convert .md file into .html
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown-js.