Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Markdown support for src file #309

Closed
pataruco opened this issue Sep 6, 2019 · 5 comments
Closed

Markdown support for src file #309

pataruco opened this issue Sep 6, 2019 · 5 comments
Labels
webpack Webpack plugins

Comments

@pataruco
Copy link

pataruco commented Sep 6, 2019

Thank you very much for your slick presentation tool!

I am wondering if it would possible on DeckDeckGoMarkdownPlugin constructor to parse the source of the markdown file, instead of to be hardcoded from DeckDeckGoMarkdownResources

Something like this

// webpack.config.ts

const plugins = [
    new DeckDeckGoMarkdownPlugin({
       src: path.resolve(__dirname, 'slides', 'intro-to-js.md'),
  }),
]
@peterpeterparker
Copy link
Contributor

@pataruco my pleasure, thx to you for calling it "slick", that makes my day 😄

currently not but I guess it would be possible to extend it, something like the following:

class DeckDeckGoMarkdownPlugin {
    
    constructor(options) {
       this.options = options;
     }

    apply(compiler) {
         // Path per default index.md if no src provided
         const path: string = path.resolve(this.options && this.options.src ?
             this.options.src : resources.Constants.SRC
       );
    }

Would that match your expectation?

May I ask, just curiosity, do you have a special use case in mind for such an application?

@peterpeterparker peterpeterparker added the webpack Webpack plugins label Sep 6, 2019
@pataruco
Copy link
Author

Thank you @peterpeterparker for your response, yes that would do the trick 🚀

I am an instructor at General Assembly, a web development academy, I use remark to parse my markdown lessons slides.

I have a repo all my lessons, and I want to be able just to change the path where the source markdown it is, instead of creating a new deckdeckgo project per lesson

@peterpeterparker
Copy link
Contributor

@pataruco done and released 😉

I've updated and released this webpack markdown plugin itself and also updated it in our starter kit

If you already have a presentation, install the last version of the plugin:

npm rm deckdeckgo-webpack-plugins --save-dev
npm install deckdeckgo-webpack-plugins --save-dev

You could modify the input file in webpack.config.js, like

new DeckDeckGoMarkdownPlugin({src: '/Users/david/mypresentation/src/hello.md'})

I didn't tried but I guess it works with a path.resolve too as the src property should be a path/string:

new DeckDeckGoMarkdownPlugin({src: path.resolve(__dirname, 'slides', 'intro-to-js.md')})

I also updated the documentation https://docs.deckdeckgo.com/edit/markdown

Let me know if it works for you, of course I'm happy to reopen the issue if it needs more work or fix.

Also don't hesitate to ping me with other cool ideas 👍

Best regards and happy weekend
David

@pataruco
Copy link
Author

Thank very much, it works!

@peterpeterparker
Copy link
Contributor

@pataruco cool thx for the feedback, happy to hear that! ping me for any other great ideas 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
webpack Webpack plugins
Projects
None yet
Development

No branches or pull requests

2 participants