Skip to content

Commit 5ee250b

Browse files
committed
Github-flavored markdown cleanup
1 parent 6e688da commit 5ee250b

2 files changed

Lines changed: 41 additions & 41 deletions

File tree

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ author: Derek Devnich
33
title: Programming in Python
44
---
55

6-
- <a href="#week-1-fundamentals" id="toc-week-1-fundamentals"><span class="toc-section-number">1</span> Week 1: Fundamentals</a>
6+
- <a href="#fundamentals-week-1" id="toc-fundamentals-week-1"><span class="toc-section-number">1</span> Fundamentals (Week 1)</a>
77
- <a href="#orientation" id="toc-orientation"><span class="toc-section-number">1.1</span> Orientation</a>
88
- <a href="#jupyter-commands" id="toc-jupyter-commands"><span class="toc-section-number">1.2</span> Jupyter commands</a>
99
- <a href="#variables-and-assignment" id="toc-variables-and-assignment"><span class="toc-section-number">1.3</span> Variables and Assignment</a>
@@ -14,7 +14,7 @@ title: Programming in Python
1414
- <a href="#strings-are-kind-of-like-lists" id="toc-strings-are-kind-of-like-lists"><span class="toc-section-number">1.8</span> Strings are (kind of) like lists</a>
1515
- <a href="#dictionaries" id="toc-dictionaries"><span class="toc-section-number">1.9</span> Dictionaries</a>
1616
- <a href="#optional-other-containers" id="toc-optional-other-containers"><span class="toc-section-number">1.10</span> (Optional) Other containers</a>
17-
- <a href="#week2-data-manipulation-with-pandas" id="toc-week2-data-manipulation-with-pandas"><span class="toc-section-number">2</span> Week2: Data manipulation with Pandas</a>
17+
- <a href="#data-manipulation-with-pandas-week-2" id="toc-data-manipulation-with-pandas-week-2"><span class="toc-section-number">2</span> Data manipulation with Pandas (Week 2)</a>
1818
- <a href="#optional-review-collections" id="toc-optional-review-collections"><span class="toc-section-number">2.1</span> (Optional) Review collections</a>
1919
- <a href="#a-very-brief-introduction-to-numpy" id="toc-a-very-brief-introduction-to-numpy"><span class="toc-section-number">2.2</span> A very brief introduction to NumPy</a>
2020
- <a href="#a-very-brief-introduction-to-pandas" id="toc-a-very-brief-introduction-to-pandas"><span class="toc-section-number">2.3</span> A very brief introduction to Pandas</a>
@@ -33,7 +33,7 @@ title: Programming in Python
3333
- <a href="#optional-pandas-method-chaining-in-the-wild" id="toc-optional-pandas-method-chaining-in-the-wild"><span class="toc-section-number">2.16</span> (Optional) Pandas method chaining in the wild</a>
3434
- <a href="#optional-introspecting-on-the-dataframe-object" id="toc-optional-introspecting-on-the-dataframe-object"><span class="toc-section-number">2.17</span> (Optional) Introspecting on the DataFrame object</a>
3535
- <a href="#carpentries-version-group-by-split-apply-combine" id="toc-carpentries-version-group-by-split-apply-combine"><span class="toc-section-number">2.18</span> (Carpentries version) Group By: split-apply-combine</a>
36-
- <a href="#week-3-building-programs" id="toc-week-3-building-programs"><span class="toc-section-number">3</span> Week 3: Building Programs</a>
36+
- <a href="#building-programs-week-3" id="toc-building-programs-week-3"><span class="toc-section-number">3</span> Building Programs (Week 3)</a>
3737
- <a href="#notebooks-vs-python-scripts" id="toc-notebooks-vs-python-scripts"><span class="toc-section-number">3.1</span> Notebooks vs Python scripts</a>
3838
- <a href="#python-from-the-terminal" id="toc-python-from-the-terminal"><span class="toc-section-number">3.2</span> Python from the terminal</a>
3939
- <a href="#for-loops" id="toc-for-loops"><span class="toc-section-number">3.3</span> For Loops</a>
@@ -45,7 +45,7 @@ title: Programming in Python
4545
- <a href="#carpentries-version-conditionals" id="toc-carpentries-version-conditionals"><span class="toc-section-number">3.9</span> (Carpentries version) Conditionals</a>
4646
- <a href="#optional-variable-scope" id="toc-optional-variable-scope"><span class="toc-section-number">3.10</span> (Optional) Variable Scope</a>
4747
- <a href="#optional-programming-style" id="toc-optional-programming-style"><span class="toc-section-number">3.11</span> (Optional) Programming Style</a>
48-
- <a href="#week-4-visualization-with-matplotlib-and-seaborn" id="toc-week-4-visualization-with-matplotlib-and-seaborn"><span class="toc-section-number">4</span> Week 4: Visualization with Matplotlib and Seaborn</a>
48+
- <a href="#visualization-with-matplotlib-and-seaborn-week-4" id="toc-visualization-with-matplotlib-and-seaborn-week-4"><span class="toc-section-number">4</span> Visualization with Matplotlib and Seaborn (Week 4)</a>
4949
- <a href="#orientation-1" id="toc-orientation-1"><span class="toc-section-number">4.1</span> Orientation</a>
5050
- <a href="#plotting-with-matplotlib" id="toc-plotting-with-matplotlib"><span class="toc-section-number">4.2</span> Plotting with Matplotlib</a>
5151
- <a href="#visualization-strategy" id="toc-visualization-strategy"><span class="toc-section-number">4.3</span> Visualization Strategy</a>
@@ -62,7 +62,7 @@ title: Programming in Python
6262
- <a href="#references" id="toc-references"><span class="toc-section-number">6.2</span> References</a>
6363
- <a href="#data-sources" id="toc-data-sources"><span class="toc-section-number">6.3</span> Data Sources</a>
6464

65-
# Week 1: Fundamentals
65+
# Fundamentals (Week 1)
6666

6767
## Orientation
6868

@@ -931,7 +931,7 @@ ages_dict = dict(zip(ages[::2], ages[1::2]))
931931
1. Tuples
932932
2. Sets
933933
934-
# Week2: Data manipulation with Pandas
934+
# Data manipulation with Pandas (Week 2)
935935
936936
## (Optional) Review collections
937937
@@ -1647,7 +1647,7 @@ wine.rename(columns={"color_intensity": "ci"})
16471647
data['normalized_wealth'] = wealth_score
16481648
```
16491649
1650-
# Week 3: Building Programs
1650+
# Building Programs (Week 3)
16511651
16521652
## Notebooks vs Python scripts
16531653
@@ -2429,7 +2429,7 @@ for i in range(5):
24292429
24302430
## (Optional) Programming Style
24312431
2432-
# Week 4: Visualization with Matplotlib and Seaborn
2432+
# Visualization with Matplotlib and Seaborn (Week 4)
24332433
24342434
## Orientation
24352435
@@ -3177,7 +3177,9 @@ with conn:
31773177
- Statistics in Python tutorial: <https://scipy-lectures.org/packages/statistics/>
31783178
- Statsmodels library: <https://www.statsmodels.org/stable/index.html>
31793179
- Matplotlib gallery of examples: <https://matplotlib.org/gallery/index.html>
3180+
- Matplotlib tutorials: <https://matplotlib.org/stable/tutorials/index.html>
31803181
- Seaborn gallery of examples: <https://seaborn.pydata.org/examples/index.html>
3182+
- Seaborn tutorials: <https://seaborn.pydata.org/tutorial.html>
31813183
- IPython magic commands: <https://ipython.readthedocs.io/en/stable/interactive/magics.html>
31823184
- A somewhat-biased comparison of tools for integrating Python with C/C++: <http://blog.behnel.de/posts/cython-pybind11-cffi-which-tool-to-choose.html>
31833185
- How to choose a code editor: <https://github.com/elliewix/Ways-Of-Installing-Python/blob/master/ways-of-installing.md#why-do-you-need-a-specific-tool>

README.org

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#+TITLE: Programming in Python
66
#+AUTHOR: Derek Devnich
77

8-
* Week 1: Fundamentals
8+
* Fundamentals (Week 1)
99
** Orientation
1010
*** What programming language should I use?
1111
1. Use the language that your friends use (so you can ask them for help)
@@ -739,7 +739,7 @@ ages_dict = dict(zip(ages[::2], ages[1::2]))
739739
1. Tuples
740740
2. Sets
741741

742-
* Week2: Data manipulation with Pandas
742+
* Data manipulation with Pandas (Week 2)
743743
** (Optional) Review collections
744744
*** Lists and dictionaries
745745
1. Reference item by index/key
@@ -1347,7 +1347,7 @@ wine.rename(columns={"color_intensity": "ci"})
13471347
data['normalized_wealth'] = wealth_score
13481348
#+END_SRC
13491349

1350-
* Week 3: Building Programs
1350+
* Building Programs (Week 3)
13511351
** Notebooks vs Python scripts
13521352
*** Differences between .ipynb and .py
13531353
1. Export notebook to .py file
@@ -2016,7 +2016,7 @@ for i in range(5):
20162016
** (Optional) Variable Scope
20172017
** (Optional) Programming Style
20182018

2019-
* Week 4: Visualization with Matplotlib and Seaborn
2019+
* Visualization with Matplotlib and Seaborn (Week 4)
20202020
** Orientation
20212021
*** Briefly revisit week 1
20222022
1. Python orientation
@@ -2700,7 +2700,9 @@ with conn:
27002700
- Statistics in Python tutorial: https://scipy-lectures.org/packages/statistics/
27012701
- Statsmodels library: https://www.statsmodels.org/stable/index.html
27022702
- Matplotlib gallery of examples: https://matplotlib.org/gallery/index.html
2703+
- Matplotlib tutorials: https://matplotlib.org/stable/tutorials/index.html
27032704
- Seaborn gallery of examples: https://seaborn.pydata.org/examples/index.html
2705+
- Seaborn tutorials: https://seaborn.pydata.org/tutorial.html
27042706
- IPython magic commands: https://ipython.readthedocs.io/en/stable/interactive/magics.html
27052707
- A somewhat-biased comparison of tools for integrating Python with C/C++: http://blog.behnel.de/posts/cython-pybind11-cffi-which-tool-to-choose.html
27062708
- How to choose a code editor: https://github.com/elliewix/Ways-Of-Installing-Python/blob/master/ways-of-installing.md#why-do-you-need-a-specific-tool
@@ -2712,53 +2714,49 @@ with conn:
27122714
4. Humanities data (Pettigrew letters): http://dx.doi.org/10.5334/data.1335350291
27132715

27142716
* COMMENT How to export this document to other formats
2715-
** Export to Markdown using Pandoc
2717+
** Export to Github-flavored Markdown using Pandoc
27162718
Do this if you want code syntax highlighting and a table of contents on Github.
2717-
*** Generate generic Markdown file
2719+
27182720
#+BEGIN_SRC bash
2719-
pandoc README.org -o tmp.md
2720-
pandoc -N -s README.org -o tmp.html
2721-
pandoc tmp.html -o tmp.md
2721+
pandoc -f org -t gfm --toc --toc-depth=2 --wrap=none -N -s README.org -o README.md
27222722
#+END_SRC
27232723

2724-
*** Edit generic Markdown file to remove illegal front matter
2725-
1. Org directives
2726-
2. Anything that isn't part of the document structure (e.g. TODO items)
2724+
** INFO (Deprecated) Export to Markdown using Pandoc
2725+
1. Generate generic Markdown file
2726+
#+BEGIN_SRC bash
2727+
pandoc README.org -o tmp.md
2728+
#+END_SRC
27272729

2728-
*** Generate Github Markdown with table of contents
2729-
#+BEGIN_SRC bash
2730-
pandoc -f markdown --toc --toc-depth=2 -s tmp.md -o README.md
2731-
pandoc -f markdown -t gfm --toc --toc-depth=2 --wrap=none -s tmp.md -o README.md
2732-
pandoc -f markdown -t gfm --toc --toc-depth=2 --wrap=none -N -s tmp.md -o README.md
2733-
pandoc -f markdown -t gfm-raw_html --toc --toc-depth=2 --wrap=none -s tmp.md -o README.md
2734-
pandoc -f html -t gfm-raw_html --toc --toc-depth=2 --wrap=none -s tmp.html -o README.md
2735-
#+END_SRC
2730+
2. Edit generic Markdown file to remove illegal front matter
2731+
1. Org directives
2732+
2. Anything that isn't part of the document structure (e.g. TODO items)
27362733

2737-
#+BEGIN_SRC bash
2738-
pandoc -f org -t gfm --toc --toc-depth=2 --wrap=none -N -s README.org -o README.md
2739-
#+END_SRC
2734+
3. Generate Github Markdown with table of contents
2735+
#+BEGIN_SRC bash
2736+
pandoc -f markdown -t gfm --toc --toc-depth=2 --wrap=none -s tmp.md -o README.md
2737+
#+END_SRC
27402738

2741-
*** Find and replace code block markers in final document
2742-
#+BEGIN_EXAMPLE
2743-
M-x qrr " {.python}" "python"
2744-
M-x qrr " {.bash}" "bash"
2745-
M-x qrr " example " fundamental
2746-
#+END_EXAMPLE
2739+
4. Find and replace code block markers in final document
2740+
#+BEGIN_EXAMPLE
2741+
M-x qrr " {.python}" "python"
2742+
M-x qrr " {.bash}" "bash"
2743+
M-x qrr " example " fundamental
2744+
#+END_EXAMPLE
27472745

2748-
** Export to Markdown using Emacs Org mode
2746+
** INFO Export to Markdown using Emacs Org mode
27492747
Do this if you want a table of contents on Github.
27502748
#+BEGIN_EXAMPLE
27512749
M-x org-md-export-to-markdown
27522750
#+END_EXAMPLE
27532751

2754-
** Export to Open Office using Emacs Org mode
2752+
** INFO Export to Open Office using Emacs Org mode
27552753
#+BEGIN_EXAMPLE
27562754
M-x org-odt-export-to-odt
27572755
#+END_EXAMPLE
27582756

2759-
** Export to Microsoft Word using Pandoc
2757+
** INFO Export to Microsoft Word using Pandoc
27602758
#+BEGIN_SRC bash
27612759
# The --reference-doc flag is optional; it provides fine-grained control
27622760
# over the appearance of the output document
2763-
pandoc README.org -t markdown | pandoc --no-highlight --reference-doc=/Users/gilgamesh/Google Drive/Templates/custom-reference.docx -o README.docx
2761+
pandoc README.org -t markdown | pandoc --no-highlight --reference-doc=custom-reference.docx -o README.docx
27642762
#+END_SRC

0 commit comments

Comments
 (0)