How to use de elm-markdown module in Elm?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to use de elm-markdown module in Elm?



I am completely new to Elm, and I am going through the examples to get acquainted with the language. The problem is that I can not run the markdown example.



The code is as follows:


import Markdown

main = Markdown.toHtml markdown

markdown = """

# This is Markdown

[Markdown](http://daringfireball.net/projects/markdown/) lets you
write content in a really natural way.

* You can have lists, like this one
* Make things **bold** or *italic*
* Embed snippets of `code`
* Create [links](/)
* ...

The [elm-markdown] package parses all this content, allowing you
to easily generate blocks of `Element` or `Html`.

[elm-markdown]: http://package.elm-lang.org/packages/evancz/elm-markdown/latest

"""



But when I try to compile it I get the following message:


I cannot find module 'Markdown'.

Module 'Main' is trying to import it.

Potential problems could be:
* Misspelled the module name
* Need to add a source directory or new dependency to elm-package.json



I have already installed the module with the command


$ elm-package install evancz/elm-markdown



Any explanation of what is happening and how to fix it will be greatly appreciated. Thanks in advance.





Is it just Markdown module you are not being able to use? The code and procedure looks fine to me (I cannot reproduce it).
– Tosh
Oct 6 '16 at 22:24





Did you run the elm package install command in the same directory where you are trying to build the code? To verify, you can run the command again, or just look to see that there is an elm-stuff directory
– Chad Gilbert
Oct 6 '16 at 22:31


elm package install


elm-stuff





@ChadGilbert That was the problem. I assumed the elm-package install would do a system wild installation. Once I execute the command in the same directory where I was trying to compile the program it worked. Thanks.
– Jeff
Oct 6 '16 at 23:07


elm-package install




2 Answers
2



Make sure to run the elm package install command in the same directory where you are trying to build the code. To verify, you can look to see that there is an elm-stuff directory.


elm package install


elm-stuff



Package installations are local to the project itself. They aren't system wide, so if you start a new project, you'll have to run elm package install in that directory too.


elm package install



In rare circumstances I've also seen that error message occur even though the package is installed. While I can't determine what caused the problem, deleting the elm-stuff and running just elm package install (no other arguments) from the project root fixes the problem.


elm-stuff


elm package install



The steps to be followed:






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered