-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-remark-autolink-headers): Allow after
option to make icon appear after header text
#19937
feat(gatsby-remark-autolink-headers): Allow after
option to make icon appear after header text
#19937
Conversation
.${className}.before { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
transform: translateX(-100%); | ||
padding-right: 4px; | ||
margin-left: -20px; | ||
} | ||
.${className}.after { | ||
display: inline-block; | ||
padding-left: 4px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I should read better)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fk can you take a quick look at this?
It looks fine to me but I'm not sure if this will be a problem for anything else in the gatsby css world. Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but haven't built locally.
## [2.1.20](2019-12-02) | ||
|
||
Allow `after` option where the link will appear inline after the header text | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog is autogenerated from commit messages, so please don't pre-emptively add to it (it can be edited afterwards if needed)
@@ -21,6 +21,7 @@ module.exports = ( | |||
maintainCase = false, | |||
removeAccents = false, | |||
enableCustomId = false, | |||
after = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this changes default behaviour (we should not do that unless we do major version bump for the plugin)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for not introducing a breaking change
@LekoArts raised a good point internally; this can be achieved with css without the need for an option; .anchor {
float: none;
margin-left: 0px;
position: absolute;
right: -60px;
top: 50%;
transform: translateY(-50%);
padding: 4px !important;
} @guyathomas can you let us know whether you feel this sufficiently solves this issue for you? |
d8bdd73
to
70320fd
Compare
Thanks for taking a look! I agree about not making the breaking changes. I'll give that CSS a whirl, but I feel it may not achieve exactly the same behaviour ( will be positioned vertically in the middle of the header, fixed on the right hand side - rather than inline (and next to ) the last letter of the header. I'll report back! |
70320fd
to
815e547
Compare
@@ -58,6 +58,7 @@ Note: if you are using `gatsby-remark-prismjs`, make sure that it’s listed aft | |||
- `maintainCase`: Boolean. Maintains the case for markdown header (optional) | |||
- `removeAccents`: Boolean. Remove accents from generated headings IDs (optional) | |||
- `enableCustomId`: Boolean. Enable custom header IDs with `{#id}` (optional) | |||
- `isIconAfterH`: Boolean. Enable the anchor icon to be inline at the end of the header text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess this is an optional option?
- `isIconAfterH`: Boolean. Enable the anchor icon to be inline at the end of the header text | |
- `isIconAfterH`: Boolean. Enable the anchor icon to be inline at the end of the header text (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! Made changes here 81ade36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is still not addressed? I mean appending (optional)
to this option description?
7782ef7
to
9872992
Compare
Mind if i grab another 👀 on this? The surface area for possible regressions
The |
3fe151c
to
bd32729
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for this improvement!
after
option for plugin to make icon appear after header textafter
option to make icon appear after header text
Holy buckets, @guyathomas — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
👍 i was thinking a little bit about naming, maybe would be this naming better? headerIconPosition: "before" #default headerIconPosition: "after" |
Description
Introduce boolean
isIconAfterH
prop ingatsby-remark-autolink-headers
that will place the icon inline, after the header text. ( Defaults tobefore
the title )Also refactor to absolutely position icon relative to the header ( and make the header
position: relative
to make this possible. This removes the need for a float 👍 )