[GH-ISSUE #129] How to import or include the markdownlint module ? #1956

Closed
opened 2026-03-07 20:03:07 +03:00 by kerem · 3 comments
Owner

Originally created by @mithuns on GitHub (Jun 26, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/129

I am just simply trying to use the demo code, in a simple node js app.
So, I have a pad.ejs, which is like a notepad where you can post markdown raw code and it follows the same idea as the demo here.
I have the scripts included in my ejs file.

<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.4.1/markdown-it.min.js"></script>
<script src="http://requirejs.org/docs/release/2.2.0/minified/require.js"></script>
<script src="markdownlint-browser.js"></script>
<script src="markdownlint-browser.min.js"></script>
<script src="default.js"></script>

And the default.js is same as default.js from demo. I have not modified anything and yet , the console throws this error

Uncaught TypeError: Cannot read property 'sync' of undefined
    at onMarkdownInput (default.js:53)
    at main (default.js:170)
    at default.js:171
onMarkdownInput @ default.js:53
main @ default.js:170
(anonymous) @ default.js:171

So, this just seems like the module is not getting loaded somehow from the script.
This is the package structure that I have
screen shot 2018-06-25 at 11 25 05 pm

I have not done a lot of nodejs development, it could be just something really silly or small that I am not doing right, can someone please help.
Thanks

Originally created by @mithuns on GitHub (Jun 26, 2018). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/129 I am just simply trying to use the demo code, in a simple node js app. So, I have a pad.ejs, which is like a notepad where you can post markdown raw code and it follows the same idea as the demo here. I have the scripts included in my ejs file. ``` <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.4.1/markdown-it.min.js"></script> <script src="http://requirejs.org/docs/release/2.2.0/minified/require.js"></script> <script src="markdownlint-browser.js"></script> <script src="markdownlint-browser.min.js"></script> <script src="default.js"></script> ``` And the default.js is same as default.js from demo. I have not modified anything and yet , the console throws this error ``` Uncaught TypeError: Cannot read property 'sync' of undefined at onMarkdownInput (default.js:53) at main (default.js:170) at default.js:171 onMarkdownInput @ default.js:53 main @ default.js:170 (anonymous) @ default.js:171 ``` So, this just seems like the module is not getting loaded somehow from the script. This is the package structure that I have ![screen shot 2018-06-25 at 11 25 05 pm](https://user-images.githubusercontent.com/3937267/41889244-21da872c-78cf-11e8-957a-40f8ccc14558.png) I have not done a lot of nodejs development, it could be just something really silly or small that I am not doing right, can someone please help. Thanks
kerem 2026-03-07 20:03:07 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Jun 26, 2018):

You need to include markdown-it and you don’t need two copies of markdownlint. Have a look at https://github.com/DavidAnson/markdownlint/blob/master/demo/default.htm and the containing directory for a working example.

<!-- gh-comment-id:400185688 --> @DavidAnson commented on GitHub (Jun 26, 2018): You need to include markdown-it and you don’t need two copies of markdownlint. Have a look at https://github.com/DavidAnson/markdownlint/blob/master/demo/default.htm and the containing directory for a working example.
Author
Owner

@mithuns commented on GitHub (Jun 26, 2018):

Thanks, that solved my problem.
We can close this.

<!-- gh-comment-id:400344266 --> @mithuns commented on GitHub (Jun 26, 2018): Thanks, that solved my problem. We can close this.
Author
Owner

@DavidAnson commented on GitHub (Jun 26, 2018):

Yay!

<!-- gh-comment-id:400344530 --> @DavidAnson commented on GitHub (Jun 26, 2018): Yay!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#1956
No description provided.