evancz / elm-markdown Goto Github PK
View Code? Open in Web Editor NEWMarkdown parsing within Elm
Home Page: http://package.elm-lang.org/packages/evancz/elm-markdown/latest
License: Other
Markdown parsing within Elm
Home Page: http://package.elm-lang.org/packages/evancz/elm-markdown/latest
License: Other
elm-explorations/markdown
Would it be possible to switch to a well-defined "flavour" of the original Markdown called CommonMark? There are very good JS implementations and I'd recommend markdown-it.
CommonMark continues in the spirit of well-defined typing (which is one of the greatest advantages of Elm) and brings it to the domain of syntax.
I created a native lib to read a .md file convert to string and the elm-markdown convert to HTML.
output is "# teste"
the typeof output is a string
when i use Markdown.toHtml [] variablewithstring i have:
(index):14120 Uncaught TypeError: src.replace is not a function
Please report this to https://github.com/chjj/marked.
at Lexer.lex ((index):14120)
at Function.Lexer.lex ((index):14120)
at marked ((index):14120)
at Object.render ((index):14079)
at render ((index):7811)
at (index):8984
at Object.callback ((index):2414)
at step ((index):3058)
at work ((index):3116)
Lexer.lex @ (index):14120
Lexer.lex @ (index):14120
marked @ (index):14120
render @ (index):14079
render @ (index):7811
(anonymous) @ (index):8984
(anonymous) @ (index):2414
step @ (index):3058
work @ (index):3116
Some thoughts are already in this message on the mailing list. Additionally, you could provide a means for the programmer to turn on auto-highlighting, where the highlight.js library's facility for detecting languages is used. That is, Markdown.Options
could include an option to turn on such auto-detection, and then in these lines, when no explicit lang
tag was given, but the programmer has turned on auto-detection, you could use something like hljs.highlightAuto(code).value
instead of hljs.highlight(lang, code, true).value
.
The bundled marked.js is apparently somewhat old, as it does not support the "three dashes smartypants" replacement. It would be nice to update the library to its latest version.
Upstream: https://github.com/chjj/marked/blame/master/lib/marked.js#L719
Highlight.js is not working out of the box. I have created a small SSCCE that demonstrates the issue.
In the preview I would expect to see the DOM modified by highlight.js. window.hljs
is defined at the time I load the elm app as you can see in the javascript console.
I originally posted this on the elm-discuss mailing list and was told this was a bug, so I'm reporting it here.
This code works fine:
import Markdown
import Time (..)
import Signal (Signal, (<~))
import Graphics.Element (Element)
import Text (..)
main : Signal Element
main = display <~ (every second)
display : Time -> Element
display time = plainText <| toString time
But when I change the plainText
to Markdown.toElement
the time no longer updates:
import Markdown
import Time (..)
import Signal (Signal, (<~))
import Graphics.Element (Element)
import Text (..)
main : Signal Element
main = display <~ (every second)
display : Time -> Element
display time = Markdown.toElement <| toString time
I tested this locally but also on the editor on the Examples page. In the actual project where I ran into this issue, the text didn't change, but it looked like the width was changing.
I happens with any table. It's not a marked
issue, since I tried the same tables directly with marked.
Tests done with:
elm-markdown
marked 0.3.3
I'd figure out by myself what's going on, but right now I don't know how to use a Elm package without using elm-pagage (i.e. use a package in development mode).
Hi Evan, Do you have a plan to update it for 0.19? this is the only package blocking us from migrating.
Many thanks!
options : Options
options =
{defaultOptions | sanitize = True}
toMarkdown : String -> Html
toMarkdown userInput =
toHtmlWith options [class "recip"] userInput
This code is presented in the "Markdown.elm" file in comment, but it doesn't work. It gives the error cited in title.
The following code works:
options : Options
options =
{defaultOptions | sanitize = True}
toMarkdown : String -> Html msg
toMarkdown userInput =
toHtmlWith options [class "recip"] userInput
Sorry for my English and thank you in advance.
I have a use-case where emoticons would be nice to have ๐
In fact, all use-cases could need a little more flare โจ
Is there any interest in Markdeep support?
http://casual-effects.com/markdeep/
It seems that it can be a thin layer over elm-svg
or is there another solution?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.