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

Fix padding for anchor-linked workflow images #20

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

lochhh
Copy link
Contributor

@lochhh lochhh commented Jan 8, 2025

In Docfx images are made clickable when the size exceeds 200 x 200.

This PR closes #19 by adding a selector for workflow <img> elements that are direct children of <a> tags.

The alternative is to apply the CSS style to all <img> elements in workflow:

.workflow img {
  padding-top: 12px;
  padding-left: 12px;
  padding-right: 12px;
}

@CLAassistant
Copy link

CLAassistant commented Jan 8, 2025

CLA assistant check
All committers have signed the CLA.

@lochhh lochhh marked this pull request as ready for review January 8, 2025 13:49
@lochhh lochhh changed the title Fix padding for anchor-linked images Fix padding for anchor-linked workflow images Jan 8, 2025
@banchan86
Copy link

Thank you, @lochhh, for investigating the issue and providing a fix—I’ll have to try it out! Do you know why the clickable script causes those images to lose their padding?

@lochhh
Copy link
Contributor Author

lochhh commented Jan 8, 2025

Thank you, @lochhh, for investigating the issue and providing a fix—I’ll have to try it out! Do you know why the clickable script causes those images to lose their padding?

The script adds the anchor as a parent of the img, so the existing css selector (.workflow > p > img) no longer applies:

<div class="workflow hljs">
  <p>
    <a target="_blank" rel="noopener noreferrer nofollow" href="https://bonsai-rx.org/docs/workflows/bonvision-render-randomgrating.svg">
      <img src="https://bonsai-rx.org/docs/workflows/bonvision-render-randomgrating.svg" alt="BonVision render random grating">
    </a>
  </p>
</div>

c.f. smaller images:

<div class="workflow hljs">
  <p>
    <img src="https://bonsai-rx.org/docs/workflows/bonvision-render-1grating.svg" alt="BonVision render grating">
  </p>
</div>

@glopesdev glopesdev merged commit e5a698f into bonsai-rx:main Jan 9, 2025
1 check passed
@lochhh lochhh deleted the issue-19 branch January 10, 2025 11:43
@banchan86
Copy link

this issue has been closed but just wanted to add a note based on a discussion @open-ephys/bonsai-onix1-docs#181 that we might want to investigate disabling the click functionality which seems to have been added for image gallery functionality ( for instance, https://dotnet.github.io/docfx/extensions/templates.html). I still need to see if workflows with images >200px are clickable with this fix.

  • I tried looking at docfx.json, but it doesn't seem to be an exposed property.
  • As the script is part of the docfx core modern template (specifically the src/markdown.ts file), I tried to see if it was possible to overwrite it with a copy of the file (similar to how Cris did it for the managedreference templates) but seems like only those files which can be seen by docfx template export modern can be overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull request that fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workflow container padding lost for workflows >3 levels high
4 participants