Add linkPrefixForNonMarkdownResources to transform config#76
Merged
bwplotka merged 2 commits intobwplotka:mainfrom Aug 24, 2021
Merged
Add linkPrefixForNonMarkdownResources to transform config#76bwplotka merged 2 commits intobwplotka:mainfrom
linkPrefixForNonMarkdownResources to transform config#76bwplotka merged 2 commits intobwplotka:mainfrom
Conversation
bwplotka
approved these changes
Aug 17, 2021
Owner
bwplotka
left a comment
There was a problem hiding this comment.
Nice work, small nits only otherwise LGTM 💪🏽
pkg/transform/testdata/mdox4.yaml
Outdated
| - "testdata/test.md" | ||
| - "testdata/teststatic" | ||
|
|
||
| glueLink: "https://github.com/bwplotka/mdox/tree/main" |
Owner
There was a problem hiding this comment.
Let's rethink the name.. maybe linkPrefixForNonMarkdownResources
pkg/transform/transform.go
Outdated
| } | ||
|
|
||
| // Non md or image relative link, so needs link to be glued. | ||
| if !isMDFile(relDest) && !isImgFile(relDest) && r.glueLink != "" { |
Owner
There was a problem hiding this comment.
nit: We could try to check for r.glueLink first as it's the most "important" one.
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
03342cd to
1be5367
Compare
glueLink to transform configlinkPrefixForNonMarkdownResources to transform config
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
linkPrefixForNonMarkdownResourcesoption to mdox transform config. This allowsmdoxto prefix non-markdown or image relative links with URL.So with config set to
linkPrefixForNonMarkdownResources: https://github.com/bwplotka/mdox/tree/main, relative links likepkg/mdformatter/mdformatter.gowill be converted tohttps://github.com/bwplotka/mdox/tree/main/pkg/mdformatter/mdformatter.go. Fixes #74.