author | Alan Dipert
<alan@dipert.org> 2025-10-08 06:48:03 UTC |
committer | Alan Dipert
<alan@dipert.org> 2025-10-08 06:48:03 UTC |
parent | 915276adb39f8b8467560c230bd28dcd0096cd0e |
md/WellReadUndergrad.md | +31 | -31 |
tools/check_links.py | +49 | -3 |
diff --git a/md/WellReadUndergrad.md b/md/WellReadUndergrad.md index d7c583a..6dc207c 100644 --- a/md/WellReadUndergrad.md +++ b/md/WellReadUndergrad.md @@ -33,12 +33,12 @@ A well-read undergraduate should ideally have read, or at least be somewhat fami - [Immanuel Kant](https://en.wikipedia.org/wiki/Immanuel_Kant) — ["Perpetual Peace"](https://en.wikipedia.org/wiki/Perpetual_Peace); ["What Is Enlightenment?"](https://en.wikipedia.org/wiki/What_Is_Enlightenment%3F) - [Ralph Waldo Emerson](https://en.wikipedia.org/wiki/Ralph_Waldo_Emerson) — [*Essays: First Series*](https://en.wikipedia.org/wiki/Essays:_First_Series) ("Friendship," "Nature," "Self-Reliance") - [Henry David Thoreau](https://en.wikipedia.org/wiki/Henry_David_Thoreau) — <span class="level-one">[*Walden*](https://en.wikipedia.org/wiki/Walden)</span>; <span class="level-one">[*Civil Disobedience*](https://en.wikipedia.org/wiki/Civil_Disobedience_(Thoreau))</span> -- [Charles Sanders Peirce](https://en.wikipedia.org/wiki/Charles_Sanders_Peirce) — ["The Fixation of Belief"](https://en.wikipedia.org/wiki/The_Fixation_of_Belief); ["How to Make Our Ideas Clear"](https://en.wikipedia.org/wiki/How_to_Make_Our_Ideas_Clear) +- [Charles Sanders Peirce](https://en.wikipedia.org/wiki/Charles_Sanders_Peirce) — ["The Fixation of Belief"](https://en.wikipedia.org/wiki/The_Fixation_of_Belief); "How to Make Our Ideas Clear" - [William Kingdon Clifford](https://en.wikipedia.org/wiki/William_Kingdon_Clifford) — <span class="level-two">["The Ethics of Belief"](https://en.wikipedia.org/wiki/The_Ethics_of_Belief)</span> - [William James](https://en.wikipedia.org/wiki/William_James) — <span class="level-two">["The Will to Believe"](https://en.wikipedia.org/wiki/The_Will_to_Believe)</span>; [*Pragmatism*](https://en.wikipedia.org/wiki/Pragmatism_(book)); ["The Moral Equivalent of War"](https://en.wikipedia.org/wiki/The_Moral_Equivalent_of_War); ["The Pragmatic Theory of Truth"](https://plato.stanford.edu/entries/truth-pragmatic/) - [Sigmund Freud](https://en.wikipedia.org/wiki/Sigmund_Freud) — [*The Interpretation of Dreams*](https://en.wikipedia.org/wiki/The_Interpretation_of_Dreams); [*The Future of an Illusion*](https://en.wikipedia.org/wiki/The_Future_of_an_Illusion); [*Civilization and Its Discontents*](https://en.wikipedia.org/wiki/Civilization_and_Its_Discontents); [*Beyond the Pleasure Principle*](https://en.wikipedia.org/wiki/Beyond_the_Pleasure_Principle) -- [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — ["A Free Man's Worship"](https://en.wikipedia.org/wiki/A_Free_Man%27s_Worship); selections from [*Why I Am Not a Christian*](https://en.wikipedia.org/wiki/Why_I_Am_Not_a_Christian) -- [Isaiah Berlin](https://en.wikipedia.org/wiki/Isaiah_Berlin) — essays such as ["The Hedgehog and the Fox"](https://en.wikipedia.org/wiki/The_Hedgehog_and_the_Fox) (in [*Russian Thinkers*](https://archive.org/details/russianthinkers00beri)) +- [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — "A Free Man's Worship"; selections from [*Why I Am Not a Christian*](https://en.wikipedia.org/wiki/Why_I_Am_Not_a_Christian) +- [Isaiah Berlin](https://en.wikipedia.org/wiki/Isaiah_Berlin) — essays such as ["The Hedgehog and the Fox"](https://en.wikipedia.org/wiki/The_Hedgehog_and_the_Fox) (in *Russian Thinkers*) - [Ayn Rand](https://en.wikipedia.org/wiki/Ayn_Rand) — [*The Virtue of Selfishness*](https://en.wikipedia.org/wiki/The_Virtue_of_Selfishness); [*Introduction to Objectivist Epistemology*](https://en.wikipedia.org/wiki/Introduction_to_Objectivist_Epistemology); John Galt's speech in [*Atlas Shrugged*](https://en.wikipedia.org/wiki/Atlas_Shrugged) ### History of Philosophy @@ -69,24 +69,24 @@ A well-read undergraduate should ideally have read, or at least be somewhat fami - [Søren Kierkegaard](https://en.wikipedia.org/wiki/S%C3%B8ren_Kierkegaard) — signature works (e.g., [*Fear and Trembling*](https://en.wikipedia.org/wiki/Fear_and_Trembling)) - [William James](https://en.wikipedia.org/wiki/William_James) — <span class="level-two">[*The Varieties of Religious Experience*](https://en.wikipedia.org/wiki/The_Varieties_of_Religious_Experience)</span> (especially "Mysticism") - [Friedrich Nietzsche](https://en.wikipedia.org/wiki/Friedrich_Nietzsche) — <span class="level-two">[*Beyond Good and Evil*](https://en.wikipedia.org/wiki/Beyond_Good_and_Evil)</span> and other mature works -- [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — <span class="level-one">[*The Problems of Philosophy*](https://en.wikipedia.org/wiki/The_Problems_of_Philosophy)</span>; [*Logic and Knowledge*](https://archive.org/details/logicandknowled00russ) +- [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — <span class="level-one">[*The Problems of Philosophy*](https://en.wikipedia.org/wiki/The_Problems_of_Philosophy)</span>; *Logic and Knowledge* #### General Histories - [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — [*History of Western Philosophy*](https://en.wikipedia.org/wiki/A_History_of_Western_Philosophy) (opinionated but readable) - [Frederick Copleston](https://en.wikipedia.org/wiki/Frederick_Copleston) — multi-volume [*History of Philosophy*](https://en.wikipedia.org/wiki/Copleston%27s_History_of_Philosophy) -- [W.T. Jones](https://en.wikipedia.org/wiki/William_T._Jones) — multi-volume [*History of Western Philosophy*](https://archive.org/details/historyofwestern01will) +- [W.T. Jones](https://en.wikipedia.org/wiki/William_T._Jones) — multi-volume *History of Western Philosophy* - [William Matson](https://en.wikipedia.org/wiki/William_Matson) — [*A New History of Philosophy*](https://archive.org/details/newhistoryofphil0001mats) (lively, two volumes) -- [Roger Scruton](https://en.wikipedia.org/wiki/Roger_Scruton) — [*A Short History of Modern Philosophy*](https://archive.org/details/shorthistoryofmo0000scru) -- [D.W. Hamlyn](https://en.wikipedia.org/wiki/D._W._Hamlyn) — [*The Penguin History of Philosophy*](https://archive.org/details/penguinhistoryof0000haml) -- [Robert C. Solomon](https://en.wikipedia.org/wiki/Robert_C._Solomon) & [Kathleen Higgins](https://liberalarts.utexas.edu/philosophy/faculty/kmh222) — [*A Passion for Wisdom*](https://archive.org/details/passionforwisdom00solo) +- [Roger Scruton](https://en.wikipedia.org/wiki/Roger_Scruton) — *A Short History of Modern Philosophy* +- [D.W. Hamlyn](https://en.wikipedia.org/wiki/D._W._Hamlyn) — *The Penguin History of Philosophy* +- [Robert C. Solomon](https://en.wikipedia.org/wiki/Robert_C._Solomon) & Kathleen Higgins — [*A Passion for Wisdom*](https://archive.org/details/passionforwisdom00solo) - [Robert C. Solomon](https://en.wikipedia.org/wiki/Robert_C._Solomon) et al. — [*A Short History of Philosophy*](https://archive.org/details/shorthistoryofph00solo) -- [Anthony Kenny](https://en.wikipedia.org/wiki/Anthony_Kenny) — [*The Oxford History of Western Philosophy*](https://archive.org/details/oxfordhistoryofw0000unse) and [*The Oxford Illustrated History of Western Philosophy*](https://archive.org/details/oxfordillustrate00anth) +- [Anthony Kenny](https://en.wikipedia.org/wiki/Anthony_Kenny) — [*The Oxford History of Western Philosophy*](https://archive.org/details/oxfordhistoryofw0000unse) and *The Oxford Illustrated History of Western Philosophy* - [Samuel Enoch Stumpf](https://en.wikipedia.org/wiki/Samuel_Enoch_Stumpf) — [*Socrates to Sartre and Beyond*](https://archive.org/details/socratestosartre0000stum) -- [Matthew Stewart](https://en.wikipedia.org/wiki/Matthew_Stewart_(philosopher)) — [*The Truth About Everything*](https://archive.org/details/truthabouteveryt00stew) -- [Ben-Ami Sharfstein](https://en.wikipedia.org/wiki/Ben-Ami_Shafstein) — [*A Comparative History of World Philosophy*](https://archive.org/details/comparativehisto0000shar) -- [Mary Warnock](https://en.wikipedia.org/wiki/Mary_Warnock) — [*Women Philosophers*](https://archive.org/details/womenphilosopher0000warn) (anthology) -- [A.J. Ayer](https://en.wikipedia.org/wiki/A._J._Ayer) & [Jane O'Grady](https://en.wikipedia.org/wiki/Jane_O%27Grady) — [*A Dictionary of Philosophical Quotations*](https://archive.org/details/dictionaryofphil0000ayer) +- [Matthew Stewart](https://en.wikipedia.org/wiki/Matthew_Stewart_(philosopher)) — *The Truth About Everything* +- [Ben-Ami Sharfstein](https://en.wikipedia.org/wiki/Ben-Ami_Shafstein) — *A Comparative History of World Philosophy* +- [Mary Warnock](https://en.wikipedia.org/wiki/Mary_Warnock) — *Women Philosophers* (anthology) +- [A.J. Ayer](https://en.wikipedia.org/wiki/A._J._Ayer) & [Jane O'Grady](https://en.wikipedia.org/wiki/Jane_O%27Grady) — *A Dictionary of Philosophical Quotations* ### Twentieth-Century Themes @@ -95,30 +95,30 @@ A well-read undergraduate should ideally have read, or at least be somewhat fami - [Martha Nussbaum](https://en.wikipedia.org/wiki/Martha_Nussbaum) — [*The Fragility of Goodness*](https://en.wikipedia.org/wiki/The_Fragility_of_Goodness) - [Robert Nozick](https://en.wikipedia.org/wiki/Robert_Nozick) — [*Anarchy, State, and Utopia*](https://en.wikipedia.org/wiki/Anarchy,_State,_and_Utopia) - [Alasdair MacIntyre](https://en.wikipedia.org/wiki/Alasdair_MacIntyre) — [*After Virtue*](https://en.wikipedia.org/wiki/After_Virtue) -- [Richard B. Brandt](https://en.wikipedia.org/wiki/Richard_B._Brandt) — <span class="level-two">[*Ethical Theory*](https://archive.org/details/ethicaltheory00bran)</span> (or comparable survey of metaethics and normative theory) +- [Richard B. Brandt](https://en.wikipedia.org/wiki/Richard_B._Brandt) — <span class="level-two">*Ethical Theory*</span> (or comparable survey of metaethics and normative theory) #### Existentialism and Continental Thought -- [William Barrett](https://en.wikipedia.org/wiki/William_Barrett_(author)) — [*Irrational Man*](https://archive.org/details/irrationalmanint00barr) -- [Robert C. Solomon](https://en.wikipedia.org/wiki/Robert_C._Solomon) — [*The Passions*](https://archive.org/details/passionsphilosop0000solo); [*The Existentialists*](https://archive.org/details/existentialists0000solo); [*Continental Philosophy Since 1750*](https://archive.org/details/continentalphilo0000solo) +- [William Barrett](https://en.wikipedia.org/wiki/William_Barrett_(author)) — *Irrational Man* +- [Robert C. Solomon](https://en.wikipedia.org/wiki/Robert_C._Solomon) — [*The Passions*](https://archive.org/details/passionsphilosop0000solo); *The Existentialists*; [*Continental Philosophy Since 1750*](https://archive.org/details/continentalphilo0000solo) - [L. Nathan Oaklander](https://en.wikipedia.org/wiki/L._Nathan_Oaklander) — [*Existentialist Philosophy*](https://archive.org/details/existentialistph0000oakl) - [Edmund Husserl](https://en.wikipedia.org/wiki/Edmund_Husserl) — representative phenomenology (e.g., [*Ideas I*](https://en.wikipedia.org/wiki/Ideas:_General_Introduction_to_Pure_Phenomenology)) - [Jean-Paul Sartre](https://en.wikipedia.org/wiki/Jean-Paul_Sartre) — selections from [*Existentialism Is a Humanism*](https://en.wikipedia.org/wiki/Existentialism_Is_a_Humanism) and [*Being and Nothingness*](https://en.wikipedia.org/wiki/Being_and_Nothingness) -- [Martin Heidegger](https://en.wikipedia.org/wiki/Martin_Heidegger) — essays such as "[What Is a Thing?](https://archive.org/details/whatisthingtr00heid)" +- [Martin Heidegger](https://en.wikipedia.org/wiki/Martin_Heidegger) — essays such as "What Is a Thing?" - [Michel Foucault](https://en.wikipedia.org/wiki/Michel_Foucault) — [*The Foucault Reader*](https://archive.org/details/foucaultreader0000fouc) (ed. Paul Rabinow) - [David H. Richter](https://en.wikipedia.org/wiki/David_H._Richter) (ed.) — <span class="level-two">[*The Critical Tradition*](https://archive.org/details/criticaltraditio0000unse)</span> #### Analytic Philosophy - [Gottlob Frege](https://en.wikipedia.org/wiki/Gottlob_Frege) — <span class="level-three">["On Sense and Reference"](https://en.wikipedia.org/wiki/Sense_and_reference), introduction to [*Begriffsschrift*](https://en.wikipedia.org/wiki/Begriffsschrift), "On Concept and Object," "On Function and Concept," "On Russell's Paradox"</span> -- [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — ["On Denoting"](https://en.wikipedia.org/wiki/On_Denoting); essays on logical atomism in [*Logic and Knowledge*](https://archive.org/details/logicandknowled00russ) +- [Bertrand Russell](https://en.wikipedia.org/wiki/Bertrand_Russell) — ["On Denoting"](https://en.wikipedia.org/wiki/On_Denoting); essays on logical atomism in *Logic and Knowledge* - [G.E. Moore](https://en.wikipedia.org/wiki/G._E._Moore) — <span class="level-two">[*Principia Ethica*](https://en.wikipedia.org/wiki/Principia_Ethica)</span> (chapter 1); ["The Refutation of Idealism"](https://en.wikipedia.org/wiki/The_Refutation_of_Idealism) -- [A.J. Ayer](https://en.wikipedia.org/wiki/A._J._Ayer) — ["The Principle of Verification"](https://plato.stanford.edu/entries/verificationism/); ["The Elimination of Metaphysics"](https://iep.utm.edu/verificationism/#SH5a) +- [A.J. Ayer](https://en.wikipedia.org/wiki/A._J._Ayer) — "The Principle of Verification"; "The Elimination of Metaphysics" - [Ludwig Wittgenstein](https://en.wikipedia.org/wiki/Ludwig_Wittgenstein) — [*Tractatus Logico-Philosophicus*](https://en.wikipedia.org/wiki/Tractatus_Logico-Philosophicus); [*Blue and Brown Books*](https://en.wikipedia.org/wiki/The_Blue_and_Brown_Books); [*Zettel*](https://en.wikipedia.org/wiki/Zettel_(Wittgenstein)); [*Philosophical Investigations*](https://en.wikipedia.org/wiki/Philosophical_Investigations); [*On Certainty*](https://en.wikipedia.org/wiki/On_Certainty) - [Gilbert Ryle](https://en.wikipedia.org/wiki/Gilbert_Ryle) — ["Descartes' Myth"](https://en.wikipedia.org/wiki/Ghost_in_the_machine#The_Categories_Goof) -- [J.L. Austin](https://en.wikipedia.org/wiki/J._L._Austin) — ["A Plea for Excuses"](https://academic.oup.com/pq/article/4/15/1/1546489); ["Other Minds"](https://www.jstor.org/stable/2251299) +- [J.L. Austin](https://en.wikipedia.org/wiki/J._L._Austin) — "A Plea for Excuses"; "Other Minds" - [Alan Turing](https://en.wikipedia.org/wiki/Alan_Turing) — <span class="level-one">["Computing Machinery and Intelligence"](https://en.wikipedia.org/wiki/Computing_Machinery_and_Intelligence)</span> -- [Edmund Gettier](https://en.wikipedia.org/wiki/Edmund_Gettier) — ["Is Justified True Belief Knowledge?"](https://philpapers.org/archive/GETIJT.pdf) -- [W.V.O. Quine](https://en.wikipedia.org/wiki/Willard_Van_Orman_Quine) — ["Two Dogmas of Empiricism"](https://www.jstor.org/stable/2181906); ["On What There Is"](https://www.jstor.org/stable/2012669) -- [John Searle](https://en.wikipedia.org/wiki/John_Searle) — ["What Is a Speech Act?"](https://www.jstor.org/stable/4544389) +- [Edmund Gettier](https://en.wikipedia.org/wiki/Edmund_Gettier) — "Is Justified True Belief Knowledge?" +- [W.V.O. Quine](https://en.wikipedia.org/wiki/Willard_Van_Orman_Quine) — "Two Dogmas of Empiricism"; "On What There Is" +- [John Searle](https://en.wikipedia.org/wiki/John_Searle) — "What Is a Speech Act?" - [Richard Rorty](https://en.wikipedia.org/wiki/Richard_Rorty) — [*Philosophy and the Mirror of Nature*](https://en.wikipedia.org/wiki/Philosophy_and_the_Mirror_of_Nature) - [Thomas Nagel](https://en.wikipedia.org/wiki/Thomas_Nagel) — <span class="level-one">["What Is It Like to Be a Bat?"](https://en.wikipedia.org/wiki/What_Is_it_Like_to_Be_a_Bat%3F)</span> @@ -126,7 +126,7 @@ A well-read undergraduate should ideally have read, or at least be somewhat fami - [Thomas Kuhn](https://en.wikipedia.org/wiki/Thomas_Kuhn) — <span class="level-three">[*The Structure of Scientific Revolutions*](https://en.wikipedia.org/wiki/The_Structure_of_Scientific_Revolutions)</span> - [Paul Feyerabend](https://en.wikipedia.org/wiki/Paul_Feyerabend) — [*Against Method*](https://en.wikipedia.org/wiki/Against_Method) - [Loren Eiseley](https://en.wikipedia.org/wiki/Loren_Eiseley) — [*The Immense Journey*](https://archive.org/details/immensejourney00eise) and related essays -- [Sherwin B. Nuland](https://en.wikipedia.org/wiki/Sherwin_B._Nuland) — [*How We Die*](https://archive.org/details/howwedienewrefle00nula) +- [Sherwin B. Nuland](https://en.wikipedia.org/wiki/Sherwin_B._Nuland) — *How We Die* - [Lewis Thomas](https://en.wikipedia.org/wiki/Lewis_Thomas) — essays such as "Germs" in [*The Lives of a Cell*](https://en.wikipedia.org/wiki/The_Lives_of_a_Cell) - [E.O. Wilson](https://en.wikipedia.org/wiki/E._O._Wilson) — [*Sociobiology*](https://en.wikipedia.org/wiki/Sociobiology:_The_New_Synthesis); [*Consilience*](https://en.wikipedia.org/wiki/Consilience_(book)) @@ -138,20 +138,20 @@ A well-read undergraduate should ideally have read, or at least be somewhat fami - [Douglas Hofstadter](https://en.wikipedia.org/wiki/Douglas_Hofstadter) — <span class="level-three">[*Gödel, Escher, Bach*](https://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach)</span>; [*Metamagical Themas*](https://en.wikipedia.org/wiki/Metamagical_Themas) - [Ivars Peterson](https://en.wikipedia.org/wiki/Ivars_Peterson) — [*The Mathematical Tourist*](https://archive.org/details/mathematicaltour00pete); [*Islands of Truth*](https://archive.org/details/islandsoftruthma0000pete) - [George Pólya](https://en.wikipedia.org/wiki/George_P%C3%B3lya) — [*How to Solve It*](https://en.wikipedia.org/wiki/How_to_Solve_It) -- [John Allen Paulos](https://en.wikipedia.org/wiki/John_Allen_Paulos) — [*Innumeracy*](https://en.wikipedia.org/wiki/Innumeracy); [*Beyond Innumeracy*](https://archive.org/details/beyondinnumeracy00paul) +- [John Allen Paulos](https://en.wikipedia.org/wiki/John_Allen_Paulos) — [*Innumeracy*](https://en.wikipedia.org/wiki/Innumeracy); *Beyond Innumeracy* #### Biographies and Intellectual Portraits - [Gay Wilson Allen](https://en.wikipedia.org/wiki/Gay_Wilson_Allen) — [*William James: A Biography*](https://archive.org/details/williamjamesbiog00alle) -- [Ray Monk](https://en.wikipedia.org/wiki/Ray_Monk) — [*Ludwig Wittgenstein: The Duty of Genius*](https://archive.org/details/ludwigwittgenste00monk); [*Bertrand Russell: The Spirit of Solitude*](https://archive.org/details/bertrandrussells00monk) -- [Paul Levy](https://en.wikipedia.org/wiki/Paul_Levy_(writer)) — [*Moore: G.E. Moore and the Cambridge Apostles*](https://archive.org/details/mooregem00paul) -- [Ved Mehta](https://en.wikipedia.org/wiki/Ved_Mehta) — [*The Fly and the Fly Bottle*](https://archive.org/details/flyflybottleenco00vedm) +- [Ray Monk](https://en.wikipedia.org/wiki/Ray_Monk) — [*Ludwig Wittgenstein: The Duty of Genius*](https://archive.org/details/ludwigwittgenste00monk); *Bertrand Russell: The Spirit of Solitude* +- [Paul Levy](https://en.wikipedia.org/wiki/Paul_Levy_(writer)) — *Moore: G.E. Moore and the Cambridge Apostles* +- [Ved Mehta](https://en.wikipedia.org/wiki/Ved_Mehta) — *The Fly and the Fly Bottle* - [Paul Feyerabend](https://en.wikipedia.org/wiki/Paul_Feyerabend) — [*Killing Time*](https://archive.org/details/killingtimeautob00feye) (autobiography) #### Logic and Philosophical Reasoning -- [Nicholas Falletta](https://en.wikipedia.org/wiki/Nicholas_Falletta) — [*Paradoxicon*](https://archive.org/details/paradoxiconbooko00fall) +- [Nicholas Falletta](https://en.wikipedia.org/wiki/Nicholas_Falletta) — *Paradoxicon* - [Irving Copi](https://en.wikipedia.org/wiki/Irving_Copi) & [Carl Cohen](https://en.wikipedia.org/wiki/Carl_Cohen) — <span class="level-one">[*Introduction to Logic*](https://archive.org/details/introductiontolo0000copi)</span> -- [Irving Copi](https://en.wikipedia.org/wiki/Irving_Copi) — [*Symbolic Logic*](https://archive.org/details/symboliclogic0000copi) -- [Richard Jeffrey](https://en.wikipedia.org/wiki/Richard_C._Jeffrey) — [*Formal Logic*](https://archive.org/details/formallogicits00jeff) +- [Irving Copi](https://en.wikipedia.org/wiki/Irving_Copi) — *Symbolic Logic* +- [Richard Jeffrey](https://en.wikipedia.org/wiki/Richard_C._Jeffrey) — *Formal Logic* - [Harry Gensler](https://en.wikipedia.org/wiki/Harry_Gensler) — [*Symbolic Logic*](https://plato.stanford.edu/entries/logic-classical/) - [George Boolos](https://en.wikipedia.org/wiki/George_Boolos) & [Richard Jeffrey](https://en.wikipedia.org/wiki/Richard_C._Jeffrey) — [*Computability and Logic*](https://archive.org/details/computabilitylog0000bool) diff --git a/tools/check_links.py b/tools/check_links.py index da0a6f2..17c8661 100755 --- a/tools/check_links.py +++ b/tools/check_links.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 -"""Check outbound links in Markdown files under md/ using curl.""" +"""Check outbound links in Markdown files using curl.""" from __future__ import annotations +import argparse import pathlib import subprocess import sys @@ -103,10 +104,55 @@ def check_url(url: str) -> tuple[bool, str, str]: return False, code, status_line.strip() -def main() -> int: +def _resolve_target(path_arg: str | None) -> pathlib.Path: + if path_arg is None: + return MD_DIR + + candidate = pathlib.Path(path_arg) + if not candidate.is_absolute(): + candidate = (pathlib.Path.cwd() / candidate).resolve() + return candidate + + +def _gather_markdown_files(target: pathlib.Path) -> list[pathlib.Path]: + if not target.exists(): + raise FileNotFoundError(f"Target does not exist: {target}") + + if target.is_file(): + if target.suffix.lower() != ".md": + raise ValueError(f"Expected a Markdown file (.md), got: {target}") + return [target] + + if target.is_dir(): + files = sorted(p for p in target.rglob("*.md") if p.is_file()) + if not files: + raise ValueError(f"No Markdown files found under {target}") + return files + + raise ValueError(f"Unhandled target type: {target}") + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser( + description="Check outbound HTTP links in Markdown files.", + ) + parser.add_argument( + "path", + nargs="?", + help="Markdown file or directory to scan (defaults to md/)", + ) + args = parser.parse_args(argv) + + try: + target = _resolve_target(args.path) + md_files = _gather_markdown_files(target) + except (FileNotFoundError, ValueError) as exc: + print(str(exc), file=sys.stderr) + return 2 + broken: dict[str, list[tuple[str, str]]] = defaultdict(list) - for md_file in sorted(MD_DIR.glob("*.md")): + for md_file in md_files: links = collect_links(md_file) for url in sorted(links): ok, code, detail = check_url(url)