question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import markdown file in script tag to display help

See original GitHub issue

I’m trying to read the content of a markdown file (.md) stored in statics or assets folder of my quasar project and I have updated the quasar.conf.js file with the following change to support raw file loading after adding raw-loader to my project

  extendWebpack(cfg) {
    cfg.module.rules.push({
      test: /\.md$/i,
      use: "raw-loader"
    });

I’m trying to load the markdown, using import command from one of the .vue component script tag as below

import md from "~statics/help.md";

But when I run the project, it compiles to 100% and throws the below error


• Compiling:
 └── SPA ████████████████████ 100% done in ~13s



 ERROR  Failed to compile with 1 errors                                                                                     8:22:43 AM

This dependency was not found:

* ~statics/help.md in ./node_modules/babel-loader/lib??ref--1-0!./node_modules/@quasar/app/lib/webpack/loader.auto-import.js?kebab!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/Help.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save ~statics/help.md

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rstoenescucommented, May 27, 2020

If u’ve seen “use” instead of “loader” then it’s a mistake in Webpack’s docs. Meaning: we’re not using “our own Webpack” but the official one 😃

1reaction
hawkeye64commented, May 25, 2020

@joyalkj Alternatively, in quasar.conf.js add an alias for a markdown folder:

      chainWebpack (chain) {
        chain.resolve.alias.merge({
          markdown: path.resolve(__dirname, './src/markdown')
        })
      }

Then you can do:

import md from 'markdown/help.md'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Add script tag to markdown file [closed] - Stack Overflow
Save this answer. Show activity on this post. You have two options: You could include raw HTML <script> tags in your Markdown, or...
Read more >
Getting Started | Markdown Guide
You can add Markdown formatting elements to a plaintext file using a text editor application. Or you can use one of the many...
Read more >
Handbook Markdown Guide - GitLab
This method works for YouTube videos and any other embed video within an <iframe> tag. Copy the code below and paste it into...
Read more >
16.1 Source external R scripts | R Markdown Cookbook
Note that we used include = FALSE in the above example because we only want to execute the script without showing any output....
Read more >
How To Use Python-Markdown to Convert Markdown Text to ...
In this tutorial, you will install the Python-Markdown library, use it to convert Markdown strings to HTML, convert Markdown files to HTML files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found