-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add option for using a custom Marp CLI config #123
Conversation
Defaults to false.
Just copying the `createConfigFile()` function for now, because we want it to return the same output.
Add a try-except-finally block. In the try block, check if the `customConfig` option is specified and load the default config file (still working on this). Else, call `createConfigFile()`) If there is an error (e.g., no file, invalid config file), revert to creating the Config File.
Added comments to propose an implementation, but my typescript is inadequate.
I prefer to leave resolution of configuration file to Marp CLI rather than find it by VS Code extension. Marp CLI will find the appropriate config file from current working directory ( |
Allow Marp CLI to find file by changing the process directory to the directory of the markdown file.
Made edits as suggested; not sure exactly why the tests are failing. |
@zhangchuck CI failed due to the incorrect Prettier formatting. Could you run |
*/ | ||
const currentDir = path.cwd() | ||
process.chdir(path.dirname(document.uri.fsPath)) | ||
await marpCli(input.path, '-o', uri.fsPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some options might have to override in CLI arguments for export the document as VS Code user expected. For example:
- Disable extra conversion modes such as watch, server, and preview mode (These bring looking like hang up conversion process in VS Code UI).
--no-server
,--no-watch
and--no-preview
will work. - Prefer export type selected in the save dialog rather than specified in configuration file. (Require to pass specific flag:
--pdf
,--pptx
, and--image [png|jpeg]
)
👍 This is what I want. |
What's the latest on this? I'd like to be able to provide my own engine when using the vscode plugin; to enable the I have this working for CLI, but I can't find a way to do this for VSCode. Does this PR address that? |
That's correct. But Marp team is not leading this PR because an implicit JS execution might make a security hole. If enabled this option in general, a malicious workspace may execute any evil script. A classic Marp app had burned out by that weakness so we are passive for supporting this PR. See also: #135 (comment) |
Closed this PR because has become too outdated. But anyone can produce another PR based on this. |
Proposal
Allow marp-vscode power users to take advantage of all features (current and future) in Marp CLI by allowing them to specify a custom config file (instead of using the default config provided by marp-vscode).
If this option is specified, the output may be different than the version seen in vscode's markdown preview. This is why the option will be by default turned off.
Related to: #85, #86, #121
Steps
customConfig
- [ ] Write logic to load custom config- [ ] Search for default config filenames in the root of the workspace directory (e.g.,.marprc
,marp.config.js
- [ ] Load the configurations and add/overwrite the default configcustomConfig
option when exporting to file to determine whether to create a default config or load a custom config- [x] Fall-back on creating a custom config