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

More extensions #60

Merged
merged 31 commits into from Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
46f2654
patch literal blocks captions; add result directive
2bndy5 Apr 1, 2022
9b716b2
update docs for results directive
2bndy5 Apr 1, 2022
d015933
add task-list directive and keys role
2bndy5 Apr 1, 2022
186e5ca
add experimental button idea
2bndy5 Apr 1, 2022
8e60344
add in new demo CSS
2bndy5 Apr 1, 2022
a150c2b
pleasing pylint
2bndy5 Apr 1, 2022
f9697ce
ran black on button.py
2bndy5 Apr 1, 2022
e89e923
partial solution to content tabs in #56
2bndy5 Apr 2, 2022
c699f76
improve api doc signatures and code block captions
2bndy5 Apr 5, 2022
6c931a9
pleasing stylelint
2bndy5 Apr 5, 2022
b03e916
pleasing pylint
2bndy5 Apr 5, 2022
3fe60a0
polish & remove experimental button.py
2bndy5 Apr 7, 2022
86f1c0d
pleasing stylelint
2bndy5 Apr 7, 2022
454dc69
still pleasing stylelint
2bndy5 Apr 7, 2022
a0fe3b2
hopefully the last stylelint fix
2bndy5 Apr 7, 2022
21624e2
[stylelint] WTH is with property ordering in scss
2bndy5 Apr 7, 2022
b1f58d0
adjust custon keys' CSS for chrome
2bndy5 Apr 11, 2022
d411a7a
remove button testing CSS
2bndy5 Apr 12, 2022
50629a2
use descrptive directive name
2bndy5 Apr 12, 2022
ba707ef
use snake casing for docutils node
2bndy5 Apr 12, 2022
40a0e9e
move a margin reset to typeset.scss
2bndy5 Apr 12, 2022
bb6ed63
review changes to kbd_keys.py
2bndy5 Apr 13, 2022
a33bd45
use plain text for keys role in latex
2bndy5 Apr 13, 2022
67e7b64
simplfy example CSS for custom task-list
2bndy5 Apr 13, 2022
3f8a83f
move rst-result CSS to _highlight.scss
2bndy5 Apr 13, 2022
10d3931
wrap each param in span & style said span
2bndy5 Apr 14, 2022
f45ac1a
[no ci] move comment to proper location
2bndy5 Apr 17, 2022
ceef35f
condensed selectors = less deviation from upstream
2bndy5 Apr 17, 2022
00c0f1c
set autocrlf to input
2bndy5 Apr 17, 2022
3231096
try overriding git global config for this repo
2bndy5 Apr 17, 2022
727abf5
override config for all files (not by core config)
2bndy5 Apr 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitattributes
@@ -0,0 +1,8 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
Copy link
Owner

Choose a reason for hiding this comment

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

I never use Windows, but why do we want any conversion of line endings at all? It seems like it would be be better to just have them always be LF at all times.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This bit was copied from the github docs. I can remove it, but it matches the settings I use globally (which I think is the default).

I added this file since npm run check spits out hundreds of errors from stylelint about the wrong line ending when I git checkout with windows.

Copy link
Owner

Choose a reason for hiding this comment

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

I guess you have core.autocrlf enabled?

I think we can disable any line ending conversion with:

* -text

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems risky without that safety net. It is a major pain in the ass to revert CRLF to LF manually if any get introduced (git diffs don't really show the distinction of different line endings - so I've been bogged down by this in the past).

I read yesterday (on the git docs) that the value input would convert CRLF to LF ("but not the other way around"). The docs are terribly worded to the point where the config option's explanation is actually confusing.

Copy link
Owner

Choose a reason for hiding this comment

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

It is not too hard to convert line endings if you find a problem --- e.g. you can use the dos2unix program.

I think the way you currently have it, autocrlf behavior will apply to all files by default if the user has core.autocrlf enabled, except that .py, .rst, and .scss files will always have LF line endings when checked out (even on Windows).

I'm not sure why we want some files to have autocrlf mode and some files always LF.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well, I did some experimenting.

  • Setting my global config core.autocrlf=input provides LF endings in the local workspace on checkout. But this overrides the eol config option.
  • When eol is set to lf, then the workspace uses LF endings (which is the desired result - even on Windows), but this means autocrlf should be set to false (which means no normalizaton of line endings on checkout).
  • If core.autocrlf=false and core.eol=lf are set via .gitattributes, they seem to have no affect when the git global config is not core.autocrlf=false.

So, I think I found a compromise to override a user's global config for this repo:

  1. * text autocrlf=false prevents line ending normalization
  2. * text eol=lf ensures workspace uses LF on checkout

This way if a CRLF is introduced, then npm run check will likely fail. At that point the user should be aware of the line endings' preference for this repo and convert them manually as needed.

git docs links

This problem seems to have been addressed so many times (in various ways) that the docs are very nuanced and damn confusing.


# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.py text eol=lf
*.rst text eol=lf
*.scss text eol=lf
42 changes: 41 additions & 1 deletion docs/_static/extra_css.css
Expand Up @@ -16,11 +16,51 @@
--md-icon__fa-gitlab: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M105.2 24.9c-3.1-8.9-15.7-8.9-18.9 0L29.8 199.7h132c-.1 0-56.6-174.8-56.6-174.8zM.9 287.7c-2.6 8 .3 16.9 7.1 22l247.9 184-226.2-294zm160.8-88 94.3 294 94.3-294zm349.4 88-28.8-88-226.3 294 247.9-184c6.9-5.1 9.7-14 7.2-22zM425.7 24.9c-3.1-8.9-15.7-8.9-18.9 0l-56.6 174.8h132z"/></svg>');
--md-icon__fa-gitkraken: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 592 512"><path d="M565.7 118.1c-2.3-6.1-9.3-9.2-15.3-6.6-5.7 2.4-8.5 8.9-6.3 14.6 10.9 29 16.9 60.5 16.9 93.3 0 134.6-100.3 245.7-230.2 262.7V358.4c7.9-1.5 15.5-3.6 23-6.2v104c106.7-25.9 185.9-122.1 185.9-236.8 0-91.8-50.8-171.8-125.8-213.3-5.7-3.2-13-.9-15.9 5-2.7 5.5-.6 12.2 4.7 15.1 67.9 37.6 113.9 110 113.9 193.2 0 93.3-57.9 173.1-139.8 205.4v-92.2c14.2-4.5 24.9-17.7 24.9-33.5 0-13.1-6.8-24.4-17.3-30.5 8.3-79.5 44.5-58.6 44.5-83.9V170c0-38-87.9-161.8-129-164.7-2.5-.2-5-.2-7.6 0C251.1 8.3 163.2 132 163.2 170v14.8c0 25.3 36.3 4.3 44.5 83.9-10.6 6.1-17.3 17.4-17.3 30.5 0 15.8 10.6 29 24.8 33.5v92.2c-81.9-32.2-139.8-112-139.8-205.4 0-83.1 46-155.5 113.9-193.2 5.4-3 7.4-9.6 4.7-15.1-2.9-5.9-10.1-8.2-15.9-5-75 41.5-125.8 121.5-125.8 213.3 0 114.7 79.2 210.8 185.9 236.8v-104c7.6 2.5 15.1 4.6 23 6.2v123.7C131.4 465.2 31 354.1 31 219.5c0-32.8 6-64.3 16.9-93.3 2.2-5.8-.6-12.2-6.3-14.6-6-2.6-13 .4-15.3 6.6C14.5 149.7 8 183.8 8 219.5c0 155.1 122.6 281.6 276.3 287.8V361.4c6.8.4 15 .5 23.4 0v145.8C461.4 501.1 584 374.6 584 219.5c0-35.7-6.5-69.8-18.3-101.4zM365.9 275.5c13 0 23.7 10.5 23.7 23.7 0 13.1-10.6 23.7-23.7 23.7-13 0-23.7-10.5-23.7-23.7 0-13.1 10.6-23.7 23.7-23.7zm-139.8 47.3c-13.2 0-23.7-10.7-23.7-23.7s10.5-23.7 23.7-23.7c13.1 0 23.7 10.6 23.7 23.7 0 13-10.5 23.7-23.7 23.7z"/></svg>');
--md-icon__fa-bitbucket: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M22.2 32A16 16 0 0 0 6 47.8a26.35 26.35 0 0 0 .2 2.8l67.9 412.1a21.77 21.77 0 0 0 21.3 18.2h325.7a16 16 0 0 0 16-13.4L505 50.7a16 16 0 0 0-13.2-18.3 24.58 24.58 0 0 0-2.8-.2L22.2 32zm285.9 297.8h-104l-28.1-147h157.3l-25.2 147z"/></svg>');
--md-admonition-icon--pied-piper: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M244 246c-3.2-2-6.3-2.9-10.1-2.9-6.6 0-12.6 3.2-19.3 3.7l1.7 4.9zm135.9 197.9c-19 0-64.1 9.5-79.9 19.8l6.9 45.1c35.7 6.1 70.1 3.6 106-9.8-4.8-10-23.5-55.1-33-55.1zM340.8 177c6.6 2.8 11.5 9.2 22.7 22.1 2-1.4 7.5-5.2 7.5-8.6 0-4.9-11.8-13.2-13.2-23 11.2-5.7 25.2-6 37.6-8.9 68.1-16.4 116.3-52.9 146.8-116.7C548.3 29.3 554 16.1 554.6 2l-2 2.6c-28.4 50-33 63.2-81.3 100-31.9 24.4-69.2 40.2-106.6 54.6l-6.3-.3v-21.8c-19.6 1.6-19.7-14.6-31.6-23-18.7 20.6-31.6 40.8-58.9 51.1-12.7 4.8-19.6 10-25.9 21.8 34.9-16.4 91.2-13.5 98.8-10zM555.5 0l-.6 1.1-.3.9.6-.6zm-59.2 382.1c-33.9-56.9-75.3-118.4-150-115.5l-.3-6c-1.1-13.5 32.8 3.2 35.1-31l-14.4 7.2c-19.8-45.7-8.6-54.3-65.5-54.3-14.7 0-26.7 1.7-41.4 4.6 2.9 18.6 2.2 36.7-10.9 50.3l19.5 5.5c-1.7 3.2-2.9 6.3-2.9 9.8 0 21 42.8 2.9 42.8 33.6 0 18.4-36.8 60.1-54.9 60.1-8 0-53.7-50-53.4-60.1l.3-4.6 52.3-11.5c13-2.6 12.3-22.7-2.9-22.7-3.7 0-43.1 9.2-49.4 10.6-2-5.2-7.5-14.1-13.8-14.1-3.2 0-6.3 3.2-9.5 4-9.2 2.6-31 2.9-21.5 20.1L15.9 298.5c-5.5 1.1-8.9 6.3-8.9 11.8 0 6 5.5 10.9 11.5 10.9 8 0 131.3-28.4 147.4-32.2 2.6 3.2 4.6 6.3 7.8 8.6 20.1 14.4 59.8 85.9 76.4 85.9 24.1 0 58-22.4 71.3-41.9 3.2-4.3 6.9-7.5 12.4-6.9.6 13.8-31.6 34.2-33 43.7-1.4 10.2-1 35.2-.3 41.1 26.7 8.1 52-3.6 77.9-2.9 4.3-21 10.6-41.9 9.8-63.5l-.3-9.5c-1.4-34.2-10.9-38.5-34.8-58.6-1.1-1.1-2.6-2.6-3.7-4 2.2-1.4 1.1-1 4.6-1.7 88.5 0 56.3 183.6 111.5 229.9 33.1-15 72.5-27.9 103.5-47.2-29-25.6-52.6-45.7-72.7-79.9zm-196.2 46.1v27.2l11.8-3.4-2.9-23.8zm-68.7-150.4l24.1 61.2 21-13.8-31.3-50.9zm84.4 154.9l2 12.4c9-1.5 58.4-6.6 58.4-14.1 0-1.4-.6-3.2-.9-4.6-26.8 0-36.9 3.8-59.5 6.3z"/></svg>')
}

/* ************************* my-special-key style ************************************* */

.md-typeset kbd.key-my-special-key,
.md-typeset kbd.key-git {
color: var(--md-primary-fg-color);
background: var(--md-accent-bg-color);
}

.md-typeset kbd.key-git::before {
content: "██";
-webkit-mask-image: var(--md-icon__fa-git);
-webkit-mask-repeat: no-repeat;
mask-image: var(--md-icon__fa-git);
mask-repeat: no-repeat;
}

.md-typeset kbd.key-my-special-key:hover,
.md-typeset kbd.key-git:hover {
color: var(--md-accent-fg-color);
}

/* **************************** custom-task-list style rules *************************** */

/* style for the unchecked checkboxes */
.custom-task-list-style > ul > li > label .task-list-indicator::before {
-webkit-mask-image: var(--md-admonition-icon--failure);
mask-image: var(--md-admonition-icon--failure);
background-color: hsl(0, 72%, 55%);
}

/* style for the checked checkboxes */
.custom-task-list-style>ul>.task-list-item>.task-list-control>[type="checkbox"]:checked+.task-list-indicator::before {
-webkit-mask-image: var(--md-admonition-icon--success);
mask-image: var(--md-admonition-icon--success);
background-color: hsl(122, 84%, 45%);
}

/* *************************** custom admonition style rules *************************** */

:root {
--md-admonition-icon--pied-piper: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M244 246c-3.2-2-6.3-2.9-10.1-2.9-6.6 0-12.6 3.2-19.3 3.7l1.7 4.9zm135.9 197.9c-19 0-64.1 9.5-79.9 19.8l6.9 45.1c35.7 6.1 70.1 3.6 106-9.8-4.8-10-23.5-55.1-33-55.1zM340.8 177c6.6 2.8 11.5 9.2 22.7 22.1 2-1.4 7.5-5.2 7.5-8.6 0-4.9-11.8-13.2-13.2-23 11.2-5.7 25.2-6 37.6-8.9 68.1-16.4 116.3-52.9 146.8-116.7C548.3 29.3 554 16.1 554.6 2l-2 2.6c-28.4 50-33 63.2-81.3 100-31.9 24.4-69.2 40.2-106.6 54.6l-6.3-.3v-21.8c-19.6 1.6-19.7-14.6-31.6-23-18.7 20.6-31.6 40.8-58.9 51.1-12.7 4.8-19.6 10-25.9 21.8 34.9-16.4 91.2-13.5 98.8-10zM555.5 0l-.6 1.1-.3.9.6-.6zm-59.2 382.1c-33.9-56.9-75.3-118.4-150-115.5l-.3-6c-1.1-13.5 32.8 3.2 35.1-31l-14.4 7.2c-19.8-45.7-8.6-54.3-65.5-54.3-14.7 0-26.7 1.7-41.4 4.6 2.9 18.6 2.2 36.7-10.9 50.3l19.5 5.5c-1.7 3.2-2.9 6.3-2.9 9.8 0 21 42.8 2.9 42.8 33.6 0 18.4-36.8 60.1-54.9 60.1-8 0-53.7-50-53.4-60.1l.3-4.6 52.3-11.5c13-2.6 12.3-22.7-2.9-22.7-3.7 0-43.1 9.2-49.4 10.6-2-5.2-7.5-14.1-13.8-14.1-3.2 0-6.3 3.2-9.5 4-9.2 2.6-31 2.9-21.5 20.1L15.9 298.5c-5.5 1.1-8.9 6.3-8.9 11.8 0 6 5.5 10.9 11.5 10.9 8 0 131.3-28.4 147.4-32.2 2.6 3.2 4.6 6.3 7.8 8.6 20.1 14.4 59.8 85.9 76.4 85.9 24.1 0 58-22.4 71.3-41.9 3.2-4.3 6.9-7.5 12.4-6.9.6 13.8-31.6 34.2-33 43.7-1.4 10.2-1 35.2-.3 41.1 26.7 8.1 52-3.6 77.9-2.9 4.3-21 10.6-41.9 9.8-63.5l-.3-9.5c-1.4-34.2-10.9-38.5-34.8-58.6-1.1-1.1-2.6-2.6-3.7-4 2.2-1.4 1.1-1 4.6-1.7 88.5 0 56.3 183.6 111.5 229.9 33.1-15 72.5-27.9 103.5-47.2-29-25.6-52.6-45.7-72.7-79.9zm-196.2 46.1v27.2l11.8-3.4-2.9-23.8zm-68.7-150.4l24.1 61.2 21-13.8-31.3-50.9zm84.4 154.9l2 12.4c9-1.5 58.4-6.6 58.4-14.1 0-1.4-.6-3.2-.9-4.6-26.8 0-36.9 3.8-59.5 6.3z"/></svg>')
}

.md-typeset .admonition.pied-piper {
border-color: rgb(43, 155, 70);
}
Expand Down