Skip to content
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

Added experimental setting markdown.marp.strictPathResolutionDuringExport #367

Merged
merged 3 commits into from
Jun 10, 2022

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Jun 10, 2022

markdown.marp.strictPathResolutionDuringExport enables strict path resolution during export.

If enabled, the export command tries to resolve relative paths from VS Code workspace that a Markdown file belongs. If not, or the Markdown does not belong to any workspace, the export command resolves paths based on the local file system.

It's useful for getting more consistent result between preview and export.

  • An inline image ![]() that refers the resource in outside of the workspace has not rendered in the preview but rendered in the export result. By enabling this option, the export command tries to resolve images from the workspace proxy so images in the outside won't be rendered as same as the preview.
  • If the Markdown file is located in [workspace-root]/markdown/abc.md, ![](/images/xyz.jpg) is referring to [workspace-root]/images/xyz.jpg at the workspace root in the preview. However, the export command could not resolve this image because the export process has not known any about of VS Code workspace. In this case, the provided option will make resolvable the image by setting correct base path during export.
  • According to experimental Markdown link validation in VS Code 1.68, the absolute path for local file like /users/xxx/abc.jpg and C:\xxx\abc.jpg should not be rendered, even if the referrenced image has located in the workspace. The preview is following this rule, but Marp's export command is not following. The added option can opt in strict path resolutions like this, and avoid unexpected resource sniffing by inline scripts in Markdown.

This option is experimental and disabled by default, to avoid breaking exist user's workflow.

Related

@yhatt yhatt merged commit e4fe672 into main Jun 10, 2022
@yhatt yhatt deleted the experimental-strict-path-resolution-during-export branch June 10, 2022 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant