Skip to content

Commit 4631c55

Browse files
committed
Extract {youShouldNotice} directive
1 parent 38ce8f2 commit 4631c55

File tree

2 files changed

+50
-78
lines changed

2 files changed

+50
-78
lines changed

modules/05-sharing-and-publishing/index.md

Lines changed: 19 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ cd # Move to your home directory
168168
git clone https://github.com/geojupyter/workshop-open-source-geospatial.git
169169
```
170170

171-
:::{important} 👀 You should notice...
172-
:class: simple
173-
:icon: false
174-
171+
:::{youShouldNotice}
175172
...this command produces output like:
176173

177174
```
@@ -197,10 +194,7 @@ On the left panel, ensure the JupyterLab file browser tab (📁 icon) is selecte
197194

198195
Double click the folder in the file browser named `workshop-open-source-geospatial`.
199196

200-
:::{important} 👀 You should notice...
201-
:class: simple
202-
:icon: false
203-
197+
:::{youShouldNotice}
204198
...a listing of around a dozen files and directories, including Markdown files and a
205199
file named `myst.yml`.
206200
:::
@@ -212,10 +206,7 @@ Locate the MyST project configuration file, `myst.yml`, in the file browser.
212206

213207
Right click this file and select the top option from the menu: "Build MyST Project".
214208

215-
:::{important} 👀 You should notice...
216-
:class: simple
217-
:icon: false
218-
209+
:::{youShouldNotice}
219210
...a new browser tab opens with a loading spinner and the title "Building MyST Site".
220211

221212
After around 5 seconds, the build will complete and the website content will display
@@ -270,10 +261,7 @@ Select your username as the owner, and enter `myst-exercise` as the repository n
270261

271262
Leave everything else as default, and click "Create repository".
272263

273-
:::{important} 👀 You should notice...
274-
:class: simple
275-
:icon: false
276-
264+
:::{youShouldNotice}
277265
...GitHub shows you a page for your new, empty repository.
278266

279267
A "Quick setup" section includes a URL you can copy.
@@ -296,10 +284,7 @@ cd
296284
git clone <YOUR_REPOSITORY_HTTPS_URL_HERE>
297285
```
298286

299-
:::{important} 👀 You should notice...
300-
:class: simple
301-
:icon: false
302-
287+
:::{youShouldNotice}
303288
...this command produces the following output:
304289

305290
```
@@ -356,10 +341,7 @@ The `$$` symbols delimit a math equation, and you can write any $ \LaTeX $ withi
356341

357342
Right-click the `myst.yml` file in the file browser, and select "Build MyST Project".
358343

359-
:::{important} 👀 You should notice...
360-
:class: simple
361-
:icon: false
362-
344+
:::{youShouldNotice}
363345
...like last time, a new browser tab opens showing a loading spinner while your site
364346
builds.
365347

@@ -438,10 +420,7 @@ site:
438420

439421
Save and rebuild your site.
440422

441-
:::{important} 👀 You should notice...
442-
:class: simple
443-
:icon: false
444-
423+
:::{youShouldNotice}
445424
...the text near the top-left of your site now says "My site" (or whatever you
446425
chose for your title) instead of "index".
447426

@@ -490,10 +469,7 @@ site:
490469

491470
Save and rebuild your site.
492471

493-
:::{important} 👀 You should notice...
494-
:class: simple
495-
:icon: false
496-
472+
:::{youShouldNotice}
497473
...the text near at the very top-left of your site now says "My logo text" (or whatever you
498474
chose for your logo text) instead of "Made with MyST".
499475
:::
@@ -532,10 +508,7 @@ Building PDF(s) from a MyST project requires one command in the terminal:
532508
myst build --pdf
533509
```
534510

535-
:::{important} 👀 You should notice...
536-
:class: simple
537-
:icon: false
538-
511+
:::{youShouldNotice}
539512
...this command fails with:
540513

541514
```
@@ -659,10 +632,7 @@ and <https://noyaml.com/>.
659632

660633
To build the PDF, try `myst build --pdf` again.
661634

662-
:::{important} 👀 You should notice...
663-
:class: simple
664-
:icon: false
665-
635+
:::{youShouldNotice}
666636
...this command produces the following output at the end:
667637

668638
```
@@ -673,10 +643,7 @@ To build the PDF, try `myst build --pdf` again.
673643
Try opening the PDF!
674644
Double-click `paper.pdf` in the JupyterLab file browser.
675645
676-
:::{important} 👀 You should notice...
677-
:class: simple
678-
:icon: false
679-
646+
:::{youShouldNotice}
680647
...the content is fairly simple.
681648
There is a title page, a blank table of contents, and then your content on the 3rd page.
682649
:::
@@ -761,10 +728,7 @@ In the terminal, from your `myst-exercise` project directory:
761728
myst init --gh-pages
762729
```
763730

764-
:::{important} 👀 You should notice...
765-
:class: simple
766-
:icon: false
767-
731+
:::{youShouldNotice}
768732
...this created a new file (and its parent directories) at
769733
`.github/workflows/deploy.yml`.
770734

@@ -785,10 +749,7 @@ we can view the build that was triggered.
785749
Visit your repository URL in GitHub.
786750
Click the "Actions" tab at the top.
787751

788-
:::{important} 👀 You should notice...
789-
:class: simple
790-
:icon: false
791-
752+
:::{youShouldNotice}
792753
...there is 1 workflow run listed, ideally with a green checkmark.
793754
:::
794755

@@ -799,10 +760,7 @@ If it succeeded, you should see a node named "deploy" displayed on the page:
799760

800761
Click the link in the "deploy" node to view your built website.
801762

802-
:::{important} 👀 You should notice...
803-
:class: simple
804-
:icon: false
805-
763+
:::{youShouldNotice}
806764
...your webpage displays on the public Internet!
807765

808766
At the top-right of this page, there's a "download" icon that looks a bit like this:
@@ -832,10 +790,7 @@ Towards the top-right, click the cog/gear icon (⚙️).
832790
Finally, check the "Use your GitHub Pages website" checkbox, and then click "Save
833791
changes".
834792

835-
:::{important} 👀 You should notice...
836-
:class: simple
837-
:icon: false
838-
793+
:::{youShouldNotice}
839794
...your GitHub Pages URL is visible near the cog/gear icon.
840795
Click the link to immediately open your website.
841796
:::
@@ -905,10 +860,7 @@ On the left panel, select "Linked accounts".
905860
On the GitHub row, click "Connect".
906861
You may be prompted to log in, then you'll be prompted to accept some dialogs.
907862

908-
:::{important} 👀 You should notice...
909-
:class: simple
910-
:icon: false
911-
863+
:::{youShouldNotice}
912864
Back in the Zenodo "Linked accounts" screen, a green checkmark will be
913865
displayed next to GitHub.
914866
:::
@@ -921,10 +873,7 @@ Zenodo interface.
921873

922874
On the left panel, select "GitHub".
923875

924-
:::{important} 👀 You should notice...
925-
:class: simple
926-
:icon: false
927-
876+
:::{youShouldNotice}
928877
...there is a large "Get started" display with a 3-step process you can follow to enable auto-DOI for a
929878
repository.
930879

@@ -987,10 +936,7 @@ Now we can build our `CITATION.cff` file with the command:
987936
myst build --cff
988937
```
989938

990-
:::{important} 👀 You should notice...
991-
:class: simple
992-
:icon: false
993-
939+
:::{youShouldNotice}
994940
...the following output:
995941

996942
```
@@ -1083,10 +1029,7 @@ Copy the "Markdown" code and paste it into a new `README.md` file in your reposi
10831029
# My exercise from the AGU workshop "Open Source Geospatial Workflows in the Cloud"
10841030
```
10851031

1086-
:::{important} 👀 You should notice...
1087-
:class: simple
1088-
:icon: false
1089-
1032+
:::{youShouldNotice}
10901033
...your repository homepage renders your `README.md` file with a pretty blue badge at the top 🤩
10911034

10921035
Clicking the badge takes you to the Zenodo homepage for your DOI.

plugin-custom-directives.mjs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,42 @@ const gitCommitDirective = {
2727
},
2828
],
2929
}],
30-
}]
30+
}];
31+
},
32+
};
33+
34+
const youShouldNoticeDirective = {
35+
name: "youShouldNotice",
36+
doc: "Renders a consistent callout when the learner should notice something.",
37+
body: {
38+
type: String
39+
},
40+
run(data, _, ctx) {
41+
return [{
42+
type: "block",
43+
children: [{
44+
type: "admonition",
45+
kind: "important",
46+
icon: false,
47+
class: "simple",
48+
children: [
49+
{
50+
type: "admonitionTitle",
51+
children: [{
52+
type: "text",
53+
value: "👀 You should notice...",
54+
}],
55+
},
56+
ctx.parseMyst(data.body),
57+
],
58+
}],
59+
}];
3160
},
3261
};
3362

3463
const plugin = {
3564
name: "Our custom functionality",
3665
doc: "Custom functionality for this workshop website",
37-
directives: [gitCommitDirective],
66+
directives: [gitCommitDirective, youShouldNoticeDirective],
3867
}
3968
export default plugin;

0 commit comments

Comments
 (0)