New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow options JavaScript file to be provided for cli #613

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
4 participants
@matthewp
Copy link

matthewp commented Jul 1, 2015

This adds an --options option. The use case is if you want to provide
more advanced options that are possible with the cli options. For
example you might want to provide a syntax highlighting function. You
could define a module like:

var highlight = require("highlight.js");

module.exports = {
  langPrefix: 'hljs ',
  highlight: function(code){
    return highlight.highlightAuto(code).value;
  }
};

and then you can use it from the cli:

cat post.md | marked --options marked_options.js
Allow options JavaScript file to be provided for cli
This adds an `--options` option. The use case is if you want to provide
more advanced options that are possible with the cli options. For
example you might want to provide a syntax highlighting function. You
could define a module like:

```js
var highlight = require("highlight.js");

module.exports = {
  langPrefix: 'hljs ',
  highlight: function(code){
    return highlight.highlightAuto(code).value;
  }
};
```

and then you can use it from the cli:

```shell
cat post.md | marked --options marked_options.js
```

 Please enter the commit message for your changes. Lines starting
@matthewp

This comment has been minimized.

Copy link

matthewp commented Oct 1, 2015

@chjj any opinion on this?

@UziTech

This comment has been minimized.

Copy link
Member

UziTech commented Apr 11, 2018

This seems very useful, however I think we are going to deprecate most options at some point to try to slim down marked, and I feel like this would be a short lived feature.

Thoughts @joshbruce @styfle?

@styfle

This comment has been minimized.

Copy link
Member

styfle commented Apr 11, 2018

I would hold off on this one too (it seems its already been on hold for 3 years).

Thinking out loud here, we might want to create a separate package marked-cli that depends on the marked package. That way the users who have no intention of every using the cli don't get anything extra.

The other thing about this PR, although its elegant, it feels wrong to pass a js file as "options".

@UziTech

This comment has been minimized.

Copy link
Member

UziTech commented Apr 11, 2018

I like the marked-cli idea 👍

@joshbruce

This comment has been minimized.

Copy link
Member

joshbruce commented Apr 12, 2018

Been thinking about separating packages a bit as well. Marked (client-side), Marked CLI, then the docs site. But this would be something more in the 1.x or 2.x imho.

@joshbruce joshbruce added this to To do in Improved product scope and purpose via automation Apr 12, 2018

@matthewp

This comment has been minimized.

Copy link

matthewp commented Apr 12, 2018

This can be closed then if you all are thinking of a different approach.

@joshbruce

This comment has been minimized.

Copy link
Member

joshbruce commented Apr 12, 2018

@matthewp: Thanks for the okay. We'll probably leave it open for a little bit. We're mainly just looking to triage things a bit better to turn the focus on passing the test cases and examples for the two supported specifications.

@UziTech UziTech closed this Dec 5, 2018

Improved product scope and purpose automation moved this from To do to Done Dec 5, 2018

@matthewp matthewp deleted the matthewp:marked-options branch Jan 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment