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

Diagrams not shown/included, only placeholder #265

Closed
hpvd opened this issue May 16, 2023 · 3 comments · Fixed by #318
Closed

Diagrams not shown/included, only placeholder #265

hpvd opened this issue May 16, 2023 · 3 comments · Fixed by #318

Comments

@hpvd
Copy link

hpvd commented May 16, 2023

Diagrams not shown/included,
only the word diagram as placeholder on:

https://docs.pact.io/implementation_guides/javascript/docs/messages

see:
2023-05-16_11h58_39

@YOU54F
Copy link
Member

YOU54F commented May 16, 2023

Ahh that page is pulled in from the pact-js repo and it uses a relative link

https://github.com/pact-foundation/pact-js/blob/master/docs/messages.md?plain=1#L19

We sync it here

https://github.com/pact-foundation/docs.pact.io/blob/master/scripts/sync/pact_js.rb

We probably want to change the images so they point to an absolute link and use the images in the pact-js codebase, or copy the images are part of the pact_js.rb sync job and rename the entry in the markdown which is alot more convoluted.

Would you be up for updating the pact-js readme to have an absolute link?

Thanks for letting us know

@YOU54F
Copy link
Member

YOU54F commented Aug 24, 2023

Fixed in pact-foundation/pact-js@7c239c2

@YOU54F YOU54F closed this as completed Aug 24, 2023
@YOU54F YOU54F reopened this Aug 25, 2023
@YOU54F
Copy link
Member

YOU54F commented Aug 25, 2023

hmm that didn't work 😅

Should be fixed for , at least until the next doc sync see https://github.com/pact-foundation/docs.pact.io

The images are only rendered if we use ?raw=true when the request is sent from Docusaurus.

We could cater for it in

def absolutize_links(contents, source_repository_slug, link_transformer, contents_source_path, synced_source_paths, branch)
contents.gsub(/\]\(([^)]+)\)/) { | match |
url = match[2..-2]
if url.start_with?('http', '#')
match
else
url_without_anchor, anchor = url.split('#', 2)
optional_anchor = anchor ? "##{anchor}" : ""
# the path of the file in the docs.pact.io site
path_from_root = if url.start_with?('.')
Addressable::URI.parse(File.join(File.dirname(contents_source_path), url_without_anchor)).normalize.to_s.chomp('/')
else
url_without_anchor.delete_prefix('/')
end
transformed_link = link_transformer.call(path_from_root) + optional_anchor
if synced_source_paths.include?(path_from_root)
"](#{transformed_link})"
elsif synced_source_paths.include?(File.join(path_from_root, 'README.md'))
"](#{transformed_link})"
else
absolute_url = (Addressable::URI.parse("https://github.com/#{source_repository_slug}/blob/#{branch}/") + path_from_root).to_s + optional_anchor
"](#{absolute_url})"
end
end
}
end
end

by adding it to any image files that are synced in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants