Skip to content

Add linkPrefixForNonMarkdownResources to transform config#76

Merged
bwplotka merged 2 commits intobwplotka:mainfrom
saswatamcode:glue-link
Aug 24, 2021
Merged

Add linkPrefixForNonMarkdownResources to transform config#76
bwplotka merged 2 commits intobwplotka:mainfrom
saswatamcode:glue-link

Conversation

@saswatamcode
Copy link
Copy Markdown
Collaborator

@saswatamcode saswatamcode commented Aug 15, 2021

This PR adds linkPrefixForNonMarkdownResources option to mdox transform config. This allows mdox to prefix non-markdown or image relative links with URL.
So with config set tolinkPrefixForNonMarkdownResources: https://github.com/bwplotka/mdox/tree/main, relative links like pkg/mdformatter/mdformatter.go will be converted to https://github.com/bwplotka/mdox/tree/main/pkg/mdformatter/mdformatter.go. Fixes #74.

@saswatamcode saswatamcode requested a review from bwplotka August 15, 2021 20:14
@saswatamcode saswatamcode self-assigned this Aug 15, 2021
Copy link
Copy Markdown
Owner

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, small nits only otherwise LGTM 💪🏽

- "testdata/test.md"
- "testdata/teststatic"

glueLink: "https://github.com/bwplotka/mdox/tree/main"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rethink the name.. maybe linkPrefixForNonMarkdownResources

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

}

// Non md or image relative link, so needs link to be glued.
if !isMDFile(relDest) && !isImgFile(relDest) && r.glueLink != "" {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We could try to check for r.glueLink first as it's the most "important" one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
@saswatamcode saswatamcode changed the title Add glueLink to transform config Add linkPrefixForNonMarkdownResources to transform config Aug 22, 2021
Copy link
Copy Markdown
Owner

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks 💪🏽

@bwplotka bwplotka merged commit db5c373 into bwplotka:main Aug 24, 2021
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.

Support for non-doc local git links

2 participants