Commit Graph

76 Commits

Author SHA1 Message Date
Alysson Rosa 937b307e84 Fixing fetch image on 'back-to-top' button 2023-06-01 09:53:39 -03:00
Alysson Rosa 22397bec6f Adding the button using JS and styling with CSS and Image 2023-05-31 17:38:44 -03:00
Petrik 4bd199301e Use h1 for guide titles
Currently the guides use the h1 tag for the guides logo instead of the
guides title. As the guides title is more important in describing the
content of a guide, the title should use the h1 instead.
This also move every other heading to a more important heading (h3 becomes h2, etc.).

This change should improve SEO for the guides.
2023-04-18 22:27:03 +02:00
Hartley McGuire a42863f514
Add rake task to vendor guide javascript
The Rails guides were migrated from Turbolinks to Turbo in
0f6575a534

The PR discussion explains that the file was grabbed from unpkg, and a
decision was made to not run it through a minifier.

This commit adds a rake task to automate the process of grabbing the
turbo js file using Importmap::Packager, which is what importmap-rails
uses for `bin/importmap pin --download`.

The extra Importmap module definition is necessary because the
Importmap::Packager file uses the shorthand module syntax, meaning that
an error is thrown if the Importmap module is not previously defined.
`require "importmap-rails"` would normally define this module, but one
of its dependent requires will not load outside of a Rails application.

The turbo.css file was removed as it appears to be leftover from
Turbolinks and Turbo does not provide any css files in its dist.
2023-02-13 00:58:58 -05:00
Rafael Mendonça França b85296efe6
Merge pull request #45932 from marcoroth/migrate-guides-to-turbo
Migrate Rails Guides from `Turbolinks` to `Turbo`
2022-11-14 18:33:44 -05:00
sampatbadhe cffce5d646 Rails Guides - set "cursor: pointer" and on hover "color: #005cc5" css to copy code button [ci-skip] 2022-11-09 07:55:49 +05:30
Marco Roth 0f6575a534 Migrate Rails Guides from `Turbolinks` to `Turbo` 2022-10-17 22:07:33 +02:00
Geon George 56e96d9344 Replaces mobi guide with epub for docs because of discontinued support
Removes kindlerb logic

Adds template for epub generator

Renames the kindle dir to /epub

Adds epub module to generator and replaces kindle

Fixes mimetype

Creates basic epub book

Deletes old kindle module

Adds zip package

Updates rubyzip gem name

Removes now unused gepub gem

Adds the required container file for epubs

Fixes media type

Adds new epub generation logic

Removes all buttons from output html

Refactors and generates valid epub files

Removes frontmatter logic used for kindlegen

Filters out epub files in zip

Updates link to kindle doc on sidebar

Fixes rubocop issues

Adds deprecation warning for the old kindle task

Refactors and cleans up epub module

Cleans up epub code

Cleans up private internal method code style

Removes unnecessary imagemagick check
2022-08-05 00:18:20 +05:30
Jonathan Hefner 23d0cd6f6f Unify LTR / RTL CSS for guides
When `main.css` is updated, it is easy for `main.rtl.css` to be
overlooked (see #45423).

This commit eliminates `main.rtl.css` in favor of a unified approach to
LTR / RTL styling in `main.css`.  To accomplish this, the `<body>`
element is rendered with a [`dir` attribute][] (which has the same
effect as setting the CSS `direction` property), and LTR- / RTL-specific
styles are prefixed with `:where(body[dir="..."])` selectors.  (The
[`:where()` pseudo-class][] ensures that selector specificity is not
changed.)

This change also paves the way for automatic detection and application
of LTR / RTL styles when the [`:dir()` pseudo-class][] gains widespread
browser support.

[`dir` attribute]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
[`:where()` pseudo-class]: https://developer.mozilla.org/en-US/docs/Web/CSS/:where
[`:dir()` pseudo-class]: https://developer.mozilla.org/en-US/docs/Web/CSS/:dir
2022-06-22 16:42:48 -05:00
Hartley McGuire 02449bf8bf
Fix guides rtl css out of sync with ltr
A few changes were made to main.css that didn't make it to
main.rtl.css:

- f6bcd14
- 9695943
- 674d952
- 5443c96
2022-06-21 17:56:53 -04:00
Rafael França b3efb35aa3
Merge pull request #42989 from jharrilim/patch-2
Change diff highlighting background for dark mode
2021-09-20 16:28:14 -04:00
ChloeLiang 881bcc3cf7 Fix docs spacing 2021-09-19 09:22:02 +08:00
Joe a3b26873eb
Change diff highlighting background for dark mode 2021-08-10 13:54:21 -04:00
Jonathan Hefner b78966b558 Render copy-to-clipboard text in element attribute [ci-skip]
Rendering copy-to-clipboard text in an invisible element causes
invisible extraneous matches when searching text on the page (e.g. with
Ctrl+F).  Rendering in an element attribute avoids this problem.
2021-07-23 12:52:10 -05:00
Eileen M. Uchitelle 52e3dc23b9
Merge pull request #42799 from lloydk/header-footer-contrast
Fix text contrast for guide header and footer [ci-skip]
2021-07-16 13:11:12 -04:00
Lloyd Kupchanko 11fc2e1566 Fix contrast ratio for guide syntax hilighting [ci-skip]
The theme used for syntax hilighting has a number of colors that
do not meet the 4.5:1 minimum contrast ratio of the Web Content
Accessibility Guidelines (WCAG) 2.1 standard.

All colors that were below 4.5:1 on a background of #eeeeee have
been adjusted to be at or slightly above 4.5:1 using tweaked
versions of the tools in this repository:

https://github.com/mpchadwick/pygments-high-contrast-stylesheets/
2021-07-16 02:41:10 -06:00
Lloyd Kupchanko 674d9523c6 Fix text contrast for guide header and footer [ci-skip]
Links in the header and footer of the guides currently have a
contrast ratio of 4.1:1 which is below the 4.5:1 ratio required
to pass the minimum Web Content Accessibility Guidelines (WCAG) 2.1
standard.

WCAG 2.1 Understanding Success Criterion 1.4.3: Contrast (Minimum)
https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html

Red text on a dark grey background (#22222) is generally considered
hard to read so the links were changed to the pink color from the
Rails Guides logo. Using pink avoids adding yet another shade of red
to the guideline color palette and as an added bonus has a contrast
ratio of 7.04:1 which meets the 7:1 ratio of the enhanced contrast
success criterion.

Understanding Success Criterion 1.4.6: Contrast (Enhanced)
https://www.w3.org/WAI/WCAG21/Understanding/contrast-enhanced
2021-07-16 01:13:40 -06:00
Lloyd Kupchanko 4eb96207b0 Show keyboard focus indicator in guides [ci-skip]
Restore the default browser focus indicator to improve the
accessibility of the guides for users who rely on a keyboard
for navigation.

For more information see:

Understanding Success Criterion 2.4.7: Focus Visible

in the Web Content Accessibility Guidelines (WCAG) 2.1
https://www.w3.org/WAI/WCAG21/Understanding/focus-visible.html
2021-07-14 01:05:36 -06:00
Henrique Morato 1c4c5736d9 [ci skip] Kindle info icon fix 2021-06-07 16:10:24 -03:00
Mark Godwin 400bf4ec04 [ci skip] Adds Dark Mode Iconography
Adds dark mode icons to the dark mode color scheme for rails guides.
2021-04-19 09:20:20 -06:00
Mark Godwin bfa5b45f42 [ci skip] Adds Dark Mode to Rails Guides
Adds dark mode classes using the @media query `prefers-color-scheme`.  Also adds a dark color scheme for code highlighting to make code snippets more readable.

[ci skip] Adds Dark Mode to Rails Guides

Adds dark mode classes using the @media query `prefers-color-scheme`.  Also adds a dark color scheme for code highlighting to make code snippets more readable.
2021-04-15 09:17:30 -06:00
Petrik a24fc7ac1d Always show version badge, not just for edge [ci skip]
Now that we have a CSS based version banner since 1c5d9a89a7
we can also show the banner for non edge versions.
2020-11-09 20:28:08 +01:00
Jonathan Hefner c73eb83c3e Fix triple-click-to-select for IRB code examples [ci-skip]
Previously, both the IRB prompt and the line of code were selected on
triple-click.  This commit causes only the line of code to be selected.
2020-10-31 16:47:52 -05:00
Petrik 4c258caba2 Add copy button for copying guide code examples [skip ci]
Instead of carefully selecting the code in examples, use a copy button
for copying the code. This uses https://clipboardjs.com/ for copying.

For the bash code examples only line starting with $ prompt are copied.
The $ prompt itself is not copied.
2020-10-01 16:32:43 +02:00
Eugene Kenny d927d3be05
Merge pull request #39777 from p8/guides/rouge-highlighting
Replace javascript highlighting in guides with Rouge [ci skip]
2020-07-08 13:59:30 +01:00
Petrik f6bcd1496e Use Rouge for guides code highlighting [ci skip]
Replace javascript highlighting using Prism with the Rouge markdown
highlighter. Uses the github theme.
2020-07-08 09:05:08 +02:00
R. Miles McCain 7f77b1d5b6
Remove broken responsive-tables JS
Add better responsive CSS for tables in guides

Fix borders & breakpoints for responsive tables

Add table fixes to RTL stylesheets

Use 480px breakpoints, remove outdated CSS
2020-07-04 06:18:58 +00:00
Jonathan Hefner 481035fba0 Use bash code fences and prompts for shell code [ci skip]
Follow-up to #39594, which added CSS in order to select shell commands
sans prompts on triple-click.

This commit adds several bash code fences and prompts where they were
missing, and removes a few where they were inappropriate.
2020-06-13 19:27:30 -05:00
Xavier Noria 1c5d9a89a7
Merge pull request #39551 from kerolloz/master
Use html-based edge badge instead of image
2020-06-13 22:37:35 +02:00
Benoit Tigeot 4399ba98e8
user-select css property is not needed
Shell prompt is already unselectable

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2020-06-13 09:47:03 +02:00
Benoit Tigeot 26eade4457
Make shell command easily selectable by making shell prompt unselectable 2020-06-12 16:12:57 +02:00
Kerollos Magdy 3ca55c591b
make edge-badge look more like the original 2020-06-12 14:57:53 +02:00
Kerollos Magdy 5443c96a07
Use html-based edge badge instead of image
I used a simple HTML-and-CSS-based approach to achieve the look of the edge badge.

* Delete edge_badge.png
* Update layout.html.erb
* Update main.css
2020-06-05 23:06:13 +02:00
Ryuta Kamizono 6a41940a96
Merge pull request #38797 from JuanitoFatas/doc/line-height
[Guides] line-height should be unitless
2020-03-23 17:29:27 +09:00
Juanito Fatas 4f2c2dc7fa Remove unused fixes.css
I checked generated guides‘s HTML and no one references .syntaxhighlighter.
2020-03-23 17:12:47 +09:00
Juanito Fatas f9dd0cab48 [Guides] line-height should be unitless
When line-height has unit, it will have unexpected results.
Based on recommendations by MDN[1] and CSSTricks[2].

[1] MDN https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#Prefer_unitless_numbers_for_line-height_values
[2] CSS Tricks https://css-tricks.com/almanac/properties/l/line-height/#article-header-id-0
2020-03-23 14:03:20 +09:00
Petrik ceb54819bd Use prism.js for code highlighting in guides [ci skip]
Replace SyntaxHighlighter with prism.js. SyntaxHighlighter does not seem
to be maintained. Prism.js seems a nice alternative with support for
Ruby, javascript, erb and yaml. Prism.js uses the MIT License.
https://github.com/PrismJS/prism

For bash a customized definition of the bash+shell-session themes is
used with the following comamnds  added commands:
brew, bundle, cat, git, gem, rackup, rake, rails, ruby, rubocop and
  yarn
2019-12-16 19:52:13 +01:00
Ramon de Paula Marques e812a3d70d increase guides chapters wrapper width 2019-10-04 15:54:50 -03:00
Prasanna.Natarajan 96959432a4 [ci skip] Markdown `highlight` doesn't work in <ul>. Add CSS to fix. 2019-09-01 11:11:42 +05:30
tamarr 29e0ed13f5
allow right to left styling of docs (#3)
* adding rtl css main file and logic to use
2018-11-19 18:59:52 +02:00
Olivier Lacan 8990921ba9 Replace outdated Rails Guides logo
The previous version wasn’t matching the Rails Guides logo source file
listed at https://github.com/rails/homepage/blob/master/materials/rails_guides_logo.psd
somehow. It was also a GIF when an 8-bit PNG results in a smaller file (2KB vs 4KB) which
should be just as widely compatible with browsers.

And that’s just for the 1x version. I added a new 2x version for “retina” or high-density
displays and a CSS @media query to progressively enhance with this high density
version of the logo. I’ve ensured that this query is supported across browsers by
using vendor-specific versions when necessary. See:
https://caniuse.com/#feat=css-media-resolution

[ci skip]
2018-10-19 19:27:04 -04:00
Olivier Lacan 068413431c Use CSS flexbox for Guides index menu
This notably allows us to tile each category without pushing the page down vertically
as much as we previously did on any viewport wider than mobile sizes.

It also means we can fit more guides which will become useful in the future since
we have several new guides in the work.

Finally the new layout allows three clearly distinct columns to emerge:
- Start Here and Rails basics: Models, Views, Controllers, Other Components
- Digging Deeper, Extending Rails, Contributing, Maintenance
- Release Notes

Having Release Notes shoot back up to the top of the third column is great
because that makes finding the latest released version and its associated
release notes much easier without having to scroll down a bunch.

[ci skip]
2018-10-19 19:26:47 -04:00
Rafael França 53be0132c3
Merge pull request #32405 from yhirano55/use_turbolinks_in_guide
Use Turbolinks in Rails guides
2018-09-06 11:13:00 -04:00
Arye Dov Eidelman bcd4c38171 [skip ci] Fix overlapping text in the guide
Fix a layout issue in the rails guides, where the navigation covers the main text,
if the page is between 800 and 960 pixels wide. (issue #33406)
2018-08-17 16:41:42 -04:00
lanzhiheng 6ad58676ec Change the background color which wrapped by code tag. [ci skip] 2018-07-19 09:49:35 +08:00
Yoshiyuki Hirano e5d38a24dc Use Turbolinks in Rails guides 2018-04-23 20:07:05 +09:00
Yoshiyuki Hirano 419adbf1a5 ✂️ jQuery for Rails Guides
* Rewrite with Vanilla JS
* Confirmed with Chrome, Safari, Firefox
2018-04-21 20:59:45 +09:00
Yoshiyuki Hirano a668f6660c Improve css in guide
* .clearfix is overridden.
* .clear is not currently used.
* #extraCol is not currently used.
* table th, table td are overridden. Merged them.
* Removed needless comment lines which are added on #6475
2018-04-01 07:29:49 +09:00
Yoshiyuki Hirano 55dc7f9e88 Remove useless stylesheet file in guide 2018-03-31 18:03:53 +09:00
claudiob 0a61a321c7 Don't highlight code in anchorlink [ci skip]
Minor fix to #28662
2017-04-04 12:09:17 -07:00