-
Notifications
You must be signed in to change notification settings - Fork 4
Redesign Stencila theme and add Wilmore #85
Conversation
6f79786
to
4bc3138
Compare
Codecov Report
@@ Coverage Diff @@
## next #85 +/- ##
=========================================
- Coverage 91.05% 87.5% -3.56%
=========================================
Files 3 4 +1
Lines 123 144 +21
Branches 35 39 +4
=========================================
+ Hits 112 126 +14
- Misses 11 18 +7
Continue to review full report at Codecov.
|
README.md
Outdated
|
||
| Selector | Description | Target | | ||
| :------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------- | | ||
| `:--root` | It maps to the root element generated by Encoda. This is done to avoid potential clashes with external stylesheets, and to ensure that Thema only styles semantically annotated content. | `[data-itemscope=root]` | |
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.
Not sure what hard dependency there might be on the name from Encoda, but this is very similar to the :root
CSS selector. Do you think it's perhaps worth renaming to :--Root
to make it less similar?
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.
Hmmm, during development I did mistakenly type :root
by accident once or twice, so do see the concern.
Not sure if it's an implementation detail or if the end-user of this selector would care, but the naming convention of TitleCase vs camelCase depends on if the selector targets a MicroData itemtype
vs itemprop
.
Do you think clarifying the fact that this selector is supposed to be used in place of :root
, and adding a Stylelint warning would be enough to helping catch issues?
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 share the concern about similarity between :--root
and :root
. On one hand it is good because it signals the intent, but on the other, can cause confusion. Regardless of either, it is error prone.
I think Alex's suggestions are good. Let's try them and see if the issue arises again. It's not a painful change if we do need to rename in the future.
/** | ||
* Group element selectors | ||
*/ | ||
@custom-selector :--ListTypes :--Article:--root > :--affiliations,:--Collection,:--List,:--references > ol; |
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.
Do you have a view on whether a it should be possible / allowable for a particular theme to define its own custom selectors, or whether you see this as a core thema fuction and so should only happen here?
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 think theme authors should have freedom to define similar selectors on a per theme basis if needed, given that they do so in a way that stays within the boundaries of the project goals (being a good CSS citizen when used in third-party contexts, and avoiding coupling of the selector targets to specific website HTML structure so as to keep the themes useful for multiple authors).
These selectors were the ones that I felt I was reaching for multiple times, and thought they would be useful across themes.
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 to "theme authors should have freedom to define similar selectors on a per theme basis if needed"
A theme well suited for consuming long-form manuscripts and prose. Named after Edmond Dantés' alias, [“Lord Wilmore: An | ||
Englishman, and the persona in which Dantès performs random acts of | ||
generosity.“](https://en.wikipedia.org/wiki/The_Count_of_Monte_Cristo#Edmond_Dantès_and_his_aliases) |
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.
Love it! Although if a "Mondego" theme appears here I may start to worry 😉
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.
Thanks @alex-ketch. I will push a commit that, I think, better co-locates the selector changes for Prism for you to review.
README.md
Outdated
|
||
| Selector | Description | Target | | ||
| :------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------- | | ||
| `:--root` | It maps to the root element generated by Encoda. This is done to avoid potential clashes with external stylesheets, and to ensure that Thema only styles semantically annotated content. | `[data-itemscope=root]` | |
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 share the concern about similarity between :--root
and :root
. On one hand it is good because it signals the intent, but on the other, can cause confusion. Regardless of either, it is error prone.
I think Alex's suggestions are good. Let's try them and see if the issue arises again. It's not a painful change if we do need to rename in the future.
/** | ||
* Group element selectors | ||
*/ | ||
@custom-selector :--ListTypes :--Article:--root > :--affiliations,:--Collection,:--List,:--references > ol; |
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 to "theme authors should have freedom to define similar selectors on a per theme basis if needed"
The advantage of putting this inside the `code` extension is that it is co-located with other aspects of integrating with PrismJS and is less invasive into other code. Also adds a test that the DOM mods are doing what is expected.
@alex-ketch I've push a commit that refactors where the PrimJS-ized selectors go. That seems to work: However, I'm not sure whether the DOM manipulations in the I don't think we should spend too much time on these workarounds for Prism - it may be more productive to create |
I've made some followup changes based on the comments @nokome. |
@custom-selector :--CodeBlock [itemtype~='http://schema.stenci.la/CodeBlock'], [itemtype~='http://schema.stenci.la/CodeBlock'] > [class*=language-]; | ||
|
||
/* prettier-ignore */ | ||
@custom-selector :--CodeBlock [itemtype~='http://schema.stenci.la/CodeBlock'], [itemtype~='http://schema.stenci.la/CodeBlock'][class*=language-]; |
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 used [itemtype~='http://schema.stenci.la/CodeBlock'] > [class*=language-]
because Encoda puts the class on the <code>
element, not it's parent <pre>
element. However, it seems that PrismJS decided to 'transfer' the class to the pre
. I which case [itemtype~='http://schema.stenci.la/CodeBlock'][class*=language-]
is fine and make more sense. Just noting that there is some magic there. All there more reason to move towards Web Components for CodeBlocks
and CodeFragments
I feel.
🎉 This PR is included in version 1.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR makes several changes, fixes, and improvements. Please see the atomic commit messages for the changelog.
Highlights:
Closes #70
Closes #73
On another note, there is a pretty severe bug when hot module reloading during development which makes things unworkable. See my comment here, in short on rebuilds, CSS from unrelated files end up in the compiled output. Only on development and only during re-builds, so doesn't affect production releases.
Theres a simple workaround, or you can disable
postcss-combine-media-query
during local development.If the author doesn't get back to us soon, I will fork the repo.