Feat: add new Markdown parser (#39800)

and change all the challenges to new `md` format.
This commit is contained in:
Oliver Eyton-Williams
2020-11-27 19:02:05 +01:00
committed by GitHub
parent a07f84c8ec
commit 0bd52f8bd1
2580 changed files with 113436 additions and 111979 deletions

View File

@ -6,41 +6,65 @@ videoUrl: 'https://scrimba.com/p/pzrPu4/cqwKrtm'
forumTopicId: 301139
---
## Description
<section id='description'>
# --description--
Media Queries are a new technique introduced in CSS3 that change the presentation of content based on different viewport sizes. The viewport is a user's visible area of a web page, and is different depending on the device used to access the site.
Media Queries consist of a media type, and if that media type matches the type of device the document is displayed on, the styles are applied. You can have as many selectors and styles inside your media query as you want.
Here's an example of a media query that returns the content when the device's width is less than or equal to 100px:
<code>@media (max-width: 100px) { /* CSS Rules */ }</code>
`@media (max-width: 100px) { /* CSS Rules */ }`
and the following media query returns the content when the device's height is more than or equal to 350px:
<code>@media (min-height: 350px) { /* CSS Rules */ }</code>
`@media (min-height: 350px) { /* CSS Rules */ }`
Remember, the CSS inside the media query is applied only if the media type matches that of the device being used.
</section>
## Instructions
<section id='instructions'>
Add a media query, so that the <code>p</code> tag has a <code>font-size</code> of <code>10px</code> when the device's height is less than or equal to <code>800px</code>.
</section>
# --instructions--
## Tests
<section id='tests'>
Add a media query, so that the `p` tag has a `font-size` of `10px` when the device's height is less than or equal to `800px`.
```yml
tests:
- text: You should declare a <code>@media</code> query for devices with a <code>height</code> less than or equal to 800px.
testString: assert($("style").text().replace(/\s/g ,'').match(/@media\(max-height:800px\)/g));
- text: Your <code>p</code> element should have a <code>font-size</code> of 10px when the device <code>height</code> is less than or equal to 800px.
testString: assert($("style").text().replace(/\s/g ,'').match(/@media\(max-height:800px\){p{font-size:10px;?}}/g));
- text: Your <code>p</code> element should have an initial <code>font-size</code> of 20px when the device <code>height</code> is more than 800px.
testString: assert($("style").text().replace(/\s/g ,'').replace(/@media.*}/g, '').match(/p{font-size:20px;?}/g));
# --hints--
You should declare a `@media` query for devices with a `height` less than or equal to 800px.
```js
assert(
$('style')
.text()
.replace(/\s/g, '')
.match(/@media\(max-height:800px\)/g)
);
```
</section>
Your `p` element should have a `font-size` of 10px when the device `height` is less than or equal to 800px.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(
$('style')
.text()
.replace(/\s/g, '')
.match(/@media\(max-height:800px\){p{font-size:10px;?}}/g)
);
```
<div id='html-seed'>
Your `p` element should have an initial `font-size` of 20px when the device `height` is more than 800px.
```js
assert(
$('style')
.text()
.replace(/\s/g, '')
.replace(/@media.*}/g, '')
.match(/p{font-size:20px;?}/g)
);
```
# --seed--
## --seed-contents--
```html
<style>
@ -56,14 +80,7 @@ tests:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst. Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat, nunc ligula ultricies diam, at aliquet velit libero a dui.</p>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -80,5 +97,3 @@ tests:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst. Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat, nunc ligula ultricies diam, at aliquet velit libero a dui.</p>
```
</section>

View File

@ -6,8 +6,8 @@ videoUrl: 'https://scrimba.com/p/pzrPu4/cz763UD'
forumTopicId: 301140
---
## Description
<section id='description'>
# --description--
Making images responsive with CSS is actually very simple. You just need to add these properties to an image:
```css
@ -18,32 +18,28 @@ img {
```
The `max-width` of `100%` will make sure the image is never wider than the container it is in, and the `height` of `auto` will make the image keep its original aspect ratio.
</section>
## Instructions
<section id='instructions'>
# --instructions--
Add the style rules to the `responsive-img` class to make it responsive. It should never be wider than its container (in this case, it's the preview window) and it should keep its original aspect ratio. After you have added your code, resize the preview to see how your images behave.
</section>
## Tests
<section id='tests'>
# --hints--
```yml
tests:
- text: Your <code>responsive-img</code> class should have a <code>max-width</code> set to <code>100%</code>.
testString: assert(getComputedStyle($('.responsive-img')[0]).maxWidth === '100%');
- text: Your <code>responsive-img</code> class should have a <code>height</code> set to <code>auto</code>.
testString: assert(code.match(/height:\s*?auto;/g));
Your `responsive-img` class should have a `max-width` set to `100%`.
```js
assert(getComputedStyle($('.responsive-img')[0]).maxWidth === '100%');
```
</section>
Your `responsive-img` class should have a `height` set to `auto`.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(code.match(/height:\s*?auto;/g));
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -61,14 +57,7 @@ img {
<img src="https://s3.amazonaws.com/freecodecamp/FCCStickerPack.jpg" alt="freeCodeCamp stickers set">
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -85,5 +74,3 @@ img {
<img class="responsive-img" src="https://s3.amazonaws.com/freecodecamp/FCCStickerPack.jpg" alt="freeCodeCamp stickers set">
<img src="https://s3.amazonaws.com/freecodecamp/FCCStickerPack.jpg" alt="freeCodeCamp stickers set">
```
</section>

View File

@ -6,38 +6,39 @@ videoUrl: 'https://scrimba.com/p/pzrPu4/crzN7T8'
forumTopicId: 301141
---
## Description
<section id='description'>
Instead of using <code>em</code> or <code>px</code> to size text, you can use viewport units for responsive typography. Viewport units, like percentages, are relative units, but they are based off different items. Viewport units are relative to the viewport dimensions (width or height) of a device, and percentages are relative to the size of the parent container element.
# --description--
Instead of using `em` or `px` to size text, you can use viewport units for responsive typography. Viewport units, like percentages, are relative units, but they are based off different items. Viewport units are relative to the viewport dimensions (width or height) of a device, and percentages are relative to the size of the parent container element.
The four different viewport units are:
<ul><li><code>vw</code> (viewport width): <code>10vw</code> would be 10% of the viewport's width.</li><li><code>vh</code> (viewport height): <code>3vh</code> would be 3% of the viewport's height.</li><li><code>vmin</code> (viewport minimum): <code>70vmin</code> would be 70% of the viewport's smaller dimension (height or width).</li><li><code>vmax</code> (viewport maximum): <code>100vmax</code> would be 100% of the viewport's bigger dimension (height or width).</li></ul>
Here is an example that sets a body tag to 30% of the viewport's width.
<code>body { width: 30vw; }</code>
</section>
## Instructions
<section id='instructions'>
Set the <code>width</code> of the <code>h2</code> tag to 80% of the viewport's width and the <code>width</code> of the paragraph as 75% of the viewport's smaller dimension.
</section>
`body { width: 30vw; }`
## Tests
<section id='tests'>
# --instructions--
```yml
tests:
- text: Your <code>h2</code> tag should have a <code>width</code> of 80vw.
testString: assert(code.match(/h2\s*?{\s*?width:\s*?80vw;\s*?}/g));
- text: Your <code>p</code> tag should have a <code>width</code> of 75vmin.
testString: assert(code.match(/p\s*?{\s*?width:\s*?75vmin;\s*?}/g));
Set the `width` of the `h2` tag to 80% of the viewport's width and the `width` of the paragraph as 75% of the viewport's smaller dimension.
# --hints--
Your `h2` tag should have a `width` of 80vw.
```js
assert(code.match(/h2\s*?{\s*?width:\s*?80vw;\s*?}/g));
```
</section>
Your `p` tag should have a `width` of 75vmin.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(code.match(/p\s*?{\s*?width:\s*?75vmin;\s*?}/g));
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -48,15 +49,7 @@ tests:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst. Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat, nunc ligula ultricies diam, at aliquet velit libero a dui.</p>
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -71,5 +64,3 @@ tests:
<h2>Importantus Ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst. Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat, nunc ligula ultricies diam, at aliquet velit libero a dui.</p>
```
</section>

View File

@ -6,12 +6,11 @@ videoUrl: 'https://scrimba.com/p/pzrPu4/cVZ4Rfp'
forumTopicId: 301142
---
## Description
<section id='description'>
# --description--
With the increase of internet connected devices, their sizes and specifications vary, and the displays they use could be different externally and internally. Pixel density is an aspect that could be different on one device from others and this density is known as Pixel Per Inch(PPI) or Dots Per Inch(DPI). The most famous such display is the one known as a "Retina Display" on the latest Apple MacBook Pro notebooks, and recently iMac computers. Due to the difference in pixel density between a "Retina" and "Non-Retina" displays, some images that have not been made with a High-Resolution Display in mind could look "pixelated" when rendered on a High-Resolution display.
The simplest way to make your images properly appear on High-Resolution Displays, such as the MacBook Pros "retina display" is to define their <code>width</code> and <code>height</code> values as only half of what the original file is.
Here is an example of an image that is only using half of the original height and width:
The simplest way to make your images properly appear on High-Resolution Displays, such as the MacBook Pros "retina display" is to define their `width` and `height` values as only half of what the original file is. Here is an example of an image that is only using half of the original height and width:
```html
<style>
@ -20,31 +19,27 @@ Here is an example of an image that is only using half of the original height an
<img src="coolPic500x500" alt="A most excellent picture">
```
</section>
# --instructions--
## Instructions
<section id='instructions'>
Set the <code>width</code> and <code>height</code> of the <code>img</code> tag to half of their original values. In this case, both the original <code>height</code> and the original <code>width</code> are <code>200px</code>.
</section>
Set the `width` and `height` of the `img` tag to half of their original values. In this case, both the original `height` and the original `width` are `200px`.
## Tests
<section id='tests'>
# --hints--
```yml
tests:
- text: Your <code>img</code> tag should have a <code>width</code> of 100 pixels.
testString: assert(document.querySelector('img').width === 100);
- text: Your <code>img</code> tag should have a <code>height</code> of 100 pixels.
testString: assert(document.querySelector('img').height === 100);
Your `img` tag should have a `width` of 100 pixels.
```js
assert(document.querySelector('img').width === 100);
```
</section>
Your `img` tag should have a `height` of 100 pixels.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(document.querySelector('img').height === 100);
```
<div id='html-seed'>
# --seed--
## --seed-contents--
```html
<style>
@ -54,14 +49,7 @@ tests:
<img src="https://s3.amazonaws.com/freecodecamp/FCCStickers-CamperBot200x200.jpg" alt="freeCodeCamp sticker that says 'Because CamperBot Cares'">
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```html
<style>
@ -73,5 +61,3 @@ tests:
<img src="https://s3.amazonaws.com/freecodecamp/FCCStickers-CamperBot200x200.jpg" alt="freeCodeCamp sticker that says 'Because CamperBot Cares'">
```
</section>