├── .eslintrc.json ├── .github └── workflows │ ├── node.js.yml │ └── npm-publish.yml ├── .gitignore ├── .husky └── pre-push ├── .prettierignore ├── .prettierrc.json ├── .vscode ├── extensions.json └── settings.json ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bin ├── app.js ├── fileFunctions.js └── options.js ├── dir1 ├── hello - Copy (2).txt ├── hello - Copy (3).txt ├── hello - Copy (4).txt ├── hello - Copy (5).txt ├── hello - Copy (6).txt ├── hello - Copy.txt ├── hello.txt └── markdown.md ├── docs ├── The Adventure of the Six Napoleans.html ├── The Adventure of the Speckled Band.html ├── The Naval Treaty.html ├── The Red Headed League.html └── index.html ├── package-lock.json ├── package.json ├── test ├── __snapshots__ │ └── fileFunction.test.js.snap ├── app.test.js ├── fileFunction.test.js ├── markdownTest.md ├── testing.txt └── textTest.txt └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": false, 4 | "node": true, 5 | "es2021": true, 6 | "jest": true 7 | }, 8 | "extends": "eslint:recommended", 9 | "parserOptions": { 10 | "ecmaVersion": 13, 11 | "sourceType": "module" 12 | }, 13 | "rules": {} 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: [push, pull_request] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | strategy: 13 | matrix: 14 | node-version: [12.x, 14.x, 16.x] 15 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v2 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | cache: "npm" 24 | - run: npm ci 25 | - run: npm run prettier-check 26 | - run: npm run eslint 27 | - run: npm test 28 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v2 16 | with: 17 | node-version: 14 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-npm: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-node@v2 27 | with: 28 | node-version: 14 29 | registry-url: https://registry.npmjs.org/ 30 | - run: npm ci 31 | - run: npm publish 32 | env: 33 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 34 | 35 | publish-gpr: 36 | needs: build 37 | runs-on: ubuntu-latest 38 | permissions: 39 | contents: read 40 | packages: write 41 | steps: 42 | - uses: actions/checkout@v2 43 | - uses: actions/setup-node@v2 44 | with: 45 | node-version: 14 46 | registry-url: https://npm.pkg.github.com/ 47 | - run: npm ci 48 | - run: npm publish 49 | env: 50 | NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | 3 | logs 4 | _.log 5 | npm-debug.log_ 6 | yarn-debug.log* 7 | yarn-error.log* 8 | lerna-debug.log\* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | 12 | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 13 | 14 | # Runtime data 15 | 16 | pids 17 | _.pid 18 | _.seed 19 | \*.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | 27 | coverage 28 | \*.lcov 29 | 30 | # nyc test coverage 31 | 32 | .nyc_output 33 | 34 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 35 | 36 | .grunt 37 | 38 | # Bower dependency directory (https://bower.io/) 39 | 40 | bower_components 41 | 42 | # node-waf configuration 43 | 44 | .lock-wscript 45 | 46 | # Compiled binary addons (https://nodejs.org/api/addons.html) 47 | 48 | build/Release 49 | 50 | # Dependency directories 51 | 52 | node_modules/ 53 | jspm_packages/ 54 | 55 | # TypeScript v1 declaration files 56 | 57 | typings/ 58 | 59 | # TypeScript cache 60 | 61 | \*.tsbuildinfo 62 | 63 | # Optional npm cache directory 64 | 65 | .npm 66 | 67 | # Optional eslint cache 68 | 69 | .eslintcache 70 | 71 | # Microbundle cache 72 | 73 | .rpt2_cache/ 74 | .rts2_cache_cjs/ 75 | .rts2_cache_es/ 76 | .rts2_cache_umd/ 77 | 78 | # Optional REPL history 79 | 80 | .node_repl_history 81 | 82 | # Output of 'npm pack' 83 | 84 | \*.tgz 85 | 86 | # Yarn Integrity file 87 | 88 | .yarn-integrity 89 | 90 | # dotenv environment variables file 91 | 92 | .env 93 | .env.test 94 | 95 | # parcel-bundler cache (https://parceljs.org/) 96 | 97 | .cache 98 | 99 | # Next.js build output 100 | 101 | .next 102 | 103 | # Nuxt.js build / generate output 104 | 105 | .nuxt 106 | dist 107 | dir1 108 | 109 | # Gatsby files 110 | 111 | .cache/ 112 | 113 | # Comment in the public line in if your project uses Gatsby and _not_ Next.js 114 | 115 | # https://nextjs.org/blog/next-9-1#public-directory-support 116 | 117 | # public 118 | 119 | # vuepress build output 120 | 121 | .vuepress/dist 122 | 123 | # Serverless directories 124 | 125 | .serverless/ 126 | 127 | # FuseBox cache 128 | 129 | .fusebox/ 130 | 131 | # DynamoDB Local files 132 | 133 | .dynamodb/ 134 | 135 | # TernJS port file 136 | 137 | .tern-port 138 | 139 | # Random Gen File 140 | 141 | .DS_Store 142 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run build -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | 3 | logs 4 | _.log 5 | npm-debug.log_ 6 | yarn-debug.log* 7 | yarn-error.log* 8 | lerna-debug.log\* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | 12 | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 13 | 14 | # Runtime data 15 | 16 | pids 17 | _.pid 18 | _.seed 19 | \*.pid.lock 20 | 21 | # Directory for instrumented libs generated by jscoverage/JSCover 22 | 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | 27 | coverage 28 | \*.lcov 29 | 30 | # nyc test coverage 31 | 32 | .nyc_output 33 | 34 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 35 | 36 | .grunt 37 | 38 | # Bower dependency directory (https://bower.io/) 39 | 40 | bower_components 41 | 42 | # node-waf configuration 43 | 44 | .lock-wscript 45 | 46 | # Compiled binary addons (https://nodejs.org/api/addons.html) 47 | 48 | build/Release 49 | 50 | # Dependency directories 51 | 52 | node_modules/ 53 | jspm_packages/ 54 | 55 | # TypeScript v1 declaration files 56 | 57 | typings/ 58 | 59 | # TypeScript cache 60 | 61 | \*.tsbuildinfo 62 | 63 | # Optional npm cache directory 64 | 65 | .npm 66 | 67 | # Optional eslint cache 68 | 69 | .eslintcache 70 | 71 | # Microbundle cache 72 | 73 | .rpt2_cache/ 74 | .rts2_cache_cjs/ 75 | .rts2_cache_es/ 76 | .rts2_cache_umd/ 77 | 78 | # Optional REPL history 79 | 80 | .node_repl_history 81 | 82 | # Output of 'npm pack' 83 | 84 | \*.tgz 85 | 86 | # Yarn Integrity file 87 | 88 | .yarn-integrity 89 | 90 | # dotenv environment variables file 91 | 92 | .env 93 | .env.test 94 | 95 | # parcel-bundler cache (https://parceljs.org/) 96 | 97 | .cache 98 | 99 | # Next.js build output 100 | 101 | .next 102 | 103 | # Nuxt.js build / generate output 104 | 105 | .nuxt 106 | dist 107 | dir1 108 | 109 | # Gatsby files 110 | 111 | .cache/ 112 | 113 | # Comment in the public line in if your project uses Gatsby and _not_ Next.js 114 | 115 | # https://nextjs.org/blog/next-9-1#public-directory-support 116 | 117 | # public 118 | 119 | # vuepress build output 120 | 121 | .vuepress/dist 122 | 123 | # Serverless directories 124 | 125 | .serverless/ 126 | 127 | # FuseBox cache 128 | 129 | .fusebox/ 130 | 131 | # DynamoDB Local files 132 | 133 | .dynamodb/ 134 | 135 | # TernJS port file 136 | 137 | .tern-port 138 | 139 | # Folder With Testing Data 140 | 141 | test/ 142 | 143 | # Random Gen File 144 | 145 | .DS_Store 146 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "esbenp.prettier-vscode", 5 | "streetsidesoftware.code-spell-checker" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "files.autoSave": "afterDelay", 4 | "editor.defaultFormatter": "esbenp.prettier-vscode", 5 | "editor.formatOnPaste": true, 6 | "editor.inlineSuggest.enabled": true 7 | } 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Tool Setup for Development 2 | 3 | ### Global 4 | 5 | This builds Octo so you can access it anywhere on your computer using the `octo` command. 6 | 7 | - Clone the repository 8 | - `cd` into the folder 9 | - run `npm i` to install all dependencies 10 | - run `npm install -g .` 11 | 12 | ### Non-Global 13 | 14 | - Clone the repository 15 | - `cd` into the folder 16 | - run `npm i` to install all dependencies 17 | - run `npm run prepare` to install husky 18 | - `cd` into the `bin` 19 | - run `node app` 20 | 21 | Every time you commit or push, husky will run some commands to make sure the code is formatted and not broken. 22 | Everything is automatic once the setup is done so you can focus on coding without problems! 23 | 24 | Here are some of the npm commands: 25 | 26 | - build: Formats with prettier and checks for eslint errors. Eslint will also try to fix any problems if any. 27 | - test: Tests prettier and eslint to find any problems. 28 | - eslint: Checks all files for errors. 29 | - eslint-fix: Tries to fix any simple eslint errors (ex. missing semicolon). 30 | - prettier: Formats all documents in the project. 31 | - prettier-check: Checks to make sure all documents are formatted. 32 | 33 | ### Extensions 34 | 35 | The extensions we use are: 36 | 37 | - prettier 38 | - eslint 39 | - code-spell-checker 40 | 41 | Visual Studio Code should ask you to download these once you open up our project! 42 | 43 | ## Tests 44 | 45 | ### Running tests 46 | 47 | To run tests for the project, you can just run the command `npm test`. This will run all of the tests within the test folder. If you want to run tests while changing code, you can run `yarn test --watch`. This will let jest constantly watch any changes within the code and run a test each time it changes. 48 | 49 | ### Writing Tests 50 | 51 | To start, this project uses [Jest](https://jestjs.io/) for all of it's testing. All tests will be written within the files of the test folder. If you need to create a new test file for a new module, use the format of `fileName.test.js` and have it placed in the test folder. 52 | 53 | ### Creating a Coverage report 54 | 55 | To quickly create a coverage report, you can use the command `npm run coverage`. This will create a report under the coverage folder showing all the details about the amount of missing and tested parts of the code. 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Octo 2 | 3 | A tool that allows you to generate static sites based off of text data and markdown. 4 | 5 | ## Install 6 | 7 | ### Package Install Mac, Linux & Windows 8 | 9 | - Make sure you have [Node LTS](https://nodejs.org/en/download/) downloaded. 10 | - Run `npm i octo-ssg -g` in terminal/powershell/cmd. 11 | - Start using Octo! 12 | 13 | ## Features 14 | 15 | ### Input 16 | 17 | The `-i or --input` flag means the input path. This will look for all texts files with the given path. You can give a .txt file as input or a directory. This is a required field for the program to work. Any files/directories with spaces should be entered with quotes `octo -i "Sherlock Holmes Selected Stories/test.txt"`. 18 | 19 | #### Examples 20 | 21 | ##### File Input 22 | 23 | This will take the content from the text file and output a HTML file. 24 | 25 | `octo -i test.txt` 26 | 27 | ##### Directory Input 28 | 29 | This will go though a directory named test and look for all nested .txt files. 30 | 31 | `octo -i test` 32 | 33 | ### Output 34 | 35 | The output allows the user to specify the path where the files/directories can be exported. This is not a required field and will default to './dist' if no option is given. 36 | 37 | #### Examples 38 | 39 | The `-o or --output` flag means the output path. This will create a folder called htmlFiles outside of the current directory. 40 | 41 | `octo -i test.txt -o ../hmtlFiles` 42 | 43 | ### Markdown File Input 44 | 45 | If a markdown file `.md` is input, the tool will convert all markdown features into appropriate HTML tags. 46 | 47 | #### Example 48 | 49 | ##### Input 50 | 51 | `octo -i markdown.md` 52 | 53 | ``` 54 | Hello This is Markdown file 55 | 56 | How are you? 57 | 58 | # This text is Markdown text 59 | 60 | #This is not Markdown text since it has a whitespace before "This" and "#" 61 | 62 | Another text. 63 | # This is another Markdown Text 64 | 65 | End of file has been reach. 66 | ``` 67 | 68 | ##### Output 69 | 70 | ``` 71 | Filename 72 | 73 | # Hello This is Markdown file 74 | 75 | How are you? 76 | 77 | # This text is Markdown text 78 | 79 | #This is not Markdown text since it has a whitespace between "This" and "#" 80 | 81 | Another text. 82 | 83 | # This is another Markdown Text 84 | 85 | End of file has been reach. 86 | 87 | ``` 88 | 89 | ### Recursive File Searching 90 | 91 | If a input is a directory, Octo will recursively go through all the child directories and convert all the text and Markdown files into HTML. 92 | 93 | ## Contributing 94 | 95 | If you want to contribute to the project, head over to [CONTRIBUTING.md](https://github.com/LuigiZaccagnini/octo/blob/main/CONTRIBUTING.md) 96 | -------------------------------------------------------------------------------- /bin/app.js: -------------------------------------------------------------------------------- 1 | //Import fileFunctions 2 | const fileFunctions = require("./fileFunctions"); 3 | const options = require("./options"); 4 | 5 | fileFunctions.addDirectory(options().output ? options().output : `./dist`); 6 | 7 | fileFunctions.main( 8 | `${options().input}`, 9 | `${options().output ? options().output : `./dist`}`, 10 | `${options().lang ? options().lang : `en_CA`}` 11 | ); 12 | -------------------------------------------------------------------------------- /bin/fileFunctions.js: -------------------------------------------------------------------------------- 1 | const fs = require(`fs`); 2 | const pathModule = require("path"); 3 | const readline = require(`readline`); 4 | const { once } = require("events"); 5 | const showdown = require("showdown"); 6 | showdown.setFlavor("github"); 7 | 8 | /** 9 | * Function that creates a directory at the given path 10 | * @param {String} directory Path where directory is created 11 | */ 12 | const addDirectory = (directory) => { 13 | try { 14 | if (!fs.existsSync(directory)) { 15 | fs.mkdirSync(directory); 16 | } else { 17 | fs.rmSync(directory, { recursive: true }, (err) => { 18 | if (err) { 19 | throw err; 20 | } 21 | }); 22 | fs.mkdirSync(directory); 23 | } 24 | } catch (err) { 25 | console.error(err); 26 | } 27 | }; 28 | 29 | /** 30 | * Function that writes content to a file at a output path 31 | * @param {String} file The name of the file that will be written 32 | * @param {String} content The information that will be written to the file 33 | * @param {String} output Output path for where the file is written 34 | */ 35 | const writeFile = (file, content, output) => { 36 | fs.writeFile(`${output}/${file}`, content, (err) => { 37 | if (err) { 38 | console.error(`This is the write file error \n${err}\n`); 39 | } 40 | }); 41 | }; 42 | 43 | /** 44 | * Function that validates a line from a file 45 | * @param {String} line line from a file 46 | * @param {Boolean} isFirstLine check if the line from the file is the first line 47 | */ 48 | const lineChecker = (line, isFirstLine) => { 49 | let document = ``; 50 | 51 | if (line !== "" && isFirstLine) { 52 | document += `

${line}

`; 53 | } else if (line !== "" && !isFirstLine) { 54 | document += `

${line}

`; 55 | } else if (line === "") { 56 | document += "
"; 57 | } 58 | 59 | return document; 60 | }; 61 | 62 | /** 63 | * Function that turns text from a .txt file into HTML 64 | * @param {String} path Path to the text file that will be converted to HTML 65 | * @return {String} Text that is converted into HTML 66 | */ 67 | const textToHTML = async (path, lang) => { 68 | let firstLine = true; 69 | let document = `Filename`; 70 | 71 | let lineReader = readline.createInterface({ 72 | input: fs.createReadStream(path, { encoding: "utf8" }), 73 | }); 74 | 75 | lineReader.on("line", function (line) { 76 | if (firstLine) { 77 | document += lineChecker(line, firstLine); 78 | firstLine = false; 79 | } else { 80 | document += lineChecker(line, firstLine); 81 | } 82 | }); 83 | 84 | await once(lineReader, "close"); 85 | document += ``; 86 | return document; 87 | }; 88 | 89 | //This function will call when .md is input 90 | const markdownToHTML = async (path, lang = `en-CA`) => { 91 | let document = `Filename`; 92 | 93 | try { 94 | var data = fs.readFileSync(path, "utf8"); 95 | document += new showdown.Converter().makeHtml(data); 96 | } catch (error) { 97 | console.log(error); 98 | } 99 | 100 | document += ``; 101 | return document; 102 | }; 103 | 104 | /** 105 | * Function that reads all files recursively 106 | * @param {String} path Path to the text file that will be converted to HTML 107 | * @param {String} output Output path for the all the files 108 | */ 109 | const main = (path, output, lang) => { 110 | fs.lstat(path, (err, stats) => { 111 | if (err) return console.log(`This is main Error \n${err}`); 112 | 113 | if (stats.isDirectory()) { 114 | fs.readdirSync(path).forEach((file) => { 115 | main(`${path}/${file}`, output, lang); 116 | }); 117 | } 118 | 119 | if (stats.isFile()) { 120 | //Added code to check file input extension 121 | if (path.includes(".txt")) { 122 | return textToHTML(path, lang).then((data) => { 123 | writeFile(pathModule.basename(path, ".txt") + ".html", data, output); 124 | }); 125 | } 126 | 127 | //Check if the file is .md file 128 | if (path.includes(".md")) { 129 | return markdownToHTML(path, lang).then((data) => { 130 | writeFile(pathModule.basename(path, ".md") + ".html", data, output); 131 | }); 132 | } 133 | 134 | return console.log("The tool only supports .txt and .md files!!"); 135 | } 136 | }); 137 | }; 138 | 139 | //Fixed module will export functions created 140 | module.exports = { 141 | main, 142 | addDirectory, 143 | markdownToHTML, 144 | writeFile, 145 | textToHTML, 146 | lineChecker, 147 | }; 148 | -------------------------------------------------------------------------------- /bin/options.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const yargs = require(`yargs`); 3 | const config = require(`../package.json`); 4 | 5 | const options = (args = process.argv.slice(2)) => 6 | yargs(args) 7 | .usage(`Usage: -i `) 8 | .option(`input`, { 9 | alias: `i`, 10 | describe: `Path to file`, 11 | type: `string`, 12 | demandOption: true, 13 | }) 14 | .option(`output`, { 15 | alias: `o`, 16 | describe: `Output directory for html parsed files`, 17 | type: `string`, 18 | default: `./dist`, 19 | }) 20 | .option(`lang`, { 21 | alias: `l`, 22 | describe: `Language attribute in HTML file`, 23 | type: `string`, 24 | default: `en_CA`, 25 | }) 26 | .help("h") 27 | .alias("h", "help") 28 | .version(`octo ${config.version}`) 29 | .alias(`v`, `version`).argv; 30 | //Using fileFuntions methods 31 | 32 | module.exports = options; 33 | -------------------------------------------------------------------------------- /dir1/hello - Copy (2).txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/hello - Copy (3).txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/hello - Copy (4).txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/hello - Copy (5).txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/hello - Copy (6).txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/hello - Copy.txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/hello.txt: -------------------------------------------------------------------------------- 1 | This is text -------------------------------------------------------------------------------- /dir1/markdown.md: -------------------------------------------------------------------------------- 1 | --- 2 | __Advertisement :)__ 3 | 4 | - __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image 5 | resize in browser. 6 | - __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly 7 | i18n with plurals support and easy syntax. 8 | 9 | You will like those projects! 10 | --- 11 | 12 | # h1 Heading 8-) 13 | 14 | ## h2 Heading 15 | 16 | ### h3 Heading 17 | 18 | #### h4 Heading 19 | 20 | ##### h5 Heading 21 | 22 | ###### h6 Heading 23 | 24 | ## Horizontal Rules 25 | 26 | --- 27 | 28 | --- 29 | 30 | --- 31 | 32 | ## Typographic replacements 33 | 34 | Enable typographer option to see result. 35 | 36 | (c) (C) (r) (R) (tm) (TM) (p) (P) +- 37 | 38 | test.. test... test..... test?..... test!.... 39 | 40 | !!!!!! ???? ,, -- --- 41 | 42 | "Smartypants, double quotes" and 'single quotes' 43 | 44 | ## Emphasis 45 | 46 | **This is bold text** 47 | 48 | **This is bold text** 49 | 50 | _This is italic text_ 51 | 52 | _This is italic text_ 53 | 54 | ~~Strikethrough~~ 55 | 56 | ## Blockquotes 57 | 58 | > Blockquotes can also be nested... 59 | > 60 | > > ...by using additional greater-than signs right next to each other... 61 | > > 62 | > > > ...or with spaces between arrows. 63 | 64 | ## Lists 65 | 66 | Unordered 67 | 68 | - Create a list by starting a line with `+`, `-`, or `*` 69 | - Sub-lists are made by indenting 2 spaces: 70 | - Marker character change forces new list start: 71 | - Ac tristique libero volutpat at 72 | * Facilisis in pretium nisl aliquet 73 | - Nulla volutpat aliquam velit 74 | - Very easy! 75 | 76 | Ordered 77 | 78 | 1. Lorem ipsum dolor sit amet 79 | 2. Consectetur adipiscing elit 80 | 3. Integer molestie lorem at massa 81 | 82 | 4. You can use sequential numbers... 83 | 5. ...or keep all the numbers as `1.` 84 | 85 | Start numbering with offset: 86 | 87 | 57. foo 88 | 1. bar 89 | 90 | ## Code 91 | 92 | Inline `code` 93 | 94 | Indented code 95 | 96 | // Some comments 97 | line 1 of code 98 | line 2 of code 99 | line 3 of code 100 | 101 | Block code "fences" 102 | 103 | ``` 104 | Sample text here... 105 | ``` 106 | 107 | Syntax highlighting 108 | 109 | ```js 110 | var foo = function (bar) { 111 | return bar++; 112 | }; 113 | 114 | console.log(foo(5)); 115 | ``` 116 | 117 | ## Tables 118 | 119 | | Option | Description | 120 | | ------ | ------------------------------------------------------------------------- | 121 | | data | path to data files to supply the data that will be passed into templates. | 122 | | engine | engine to be used for processing templates. Handlebars is the default. | 123 | | ext | extension to be used for dest files. | 124 | 125 | Right aligned columns 126 | 127 | | Option | Description | 128 | | -----: | ------------------------------------------------------------------------: | 129 | | data | path to data files to supply the data that will be passed into templates. | 130 | | engine | engine to be used for processing templates. Handlebars is the default. | 131 | | ext | extension to be used for dest files. | 132 | 133 | ## Links 134 | 135 | [link text](http://dev.nodeca.com) 136 | 137 | [link with title](http://nodeca.github.io/pica/demo/ "title text!") 138 | 139 | Autoconverted link https://github.com/nodeca/pica (enable linkify to see) 140 | 141 | ## Images 142 | 143 | ![Minion](https://octodex.github.com/images/minion.png) 144 | ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") 145 | 146 | Like links, Images also have a footnote style syntax 147 | 148 | ![Alt text][id] 149 | 150 | With a reference later in the document defining the URL location: 151 | 152 | [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" 153 | 154 | ## Plugins 155 | 156 | The killer feature of `markdown-it` is very effective support of 157 | [syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin). 158 | 159 | ### [Emojies](https://github.com/markdown-it/markdown-it-emoji) 160 | 161 | > Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum: 162 | > 163 | > Shortcuts (emoticons): :-) :-( 8-) ;) 164 | 165 | see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji. 166 | 167 | ### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup) 168 | 169 | - 19^th^ 170 | - H~2~O 171 | 172 | ### [\](https://github.com/markdown-it/markdown-it-ins) 173 | 174 | ++Inserted text++ 175 | 176 | ### [\](https://github.com/markdown-it/markdown-it-mark) 177 | 178 | ==Marked text== 179 | 180 | ### [Footnotes](https://github.com/markdown-it/markdown-it-footnote) 181 | 182 | Footnote 1 link[^first]. 183 | 184 | Footnote 2 link[^second]. 185 | 186 | Inline footnote^[Text of inline footnote] definition. 187 | 188 | Duplicated footnote reference[^second]. 189 | 190 | [^first]: Footnote **can have markup** 191 | 192 | and multiple paragraphs. 193 | 194 | [^second]: Footnote text. 195 | 196 | ### [Definition lists](https://github.com/markdown-it/markdown-it-deflist) 197 | 198 | Term 1 199 | 200 | : Definition 1 201 | with lazy continuation. 202 | 203 | Term 2 with _inline markup_ 204 | 205 | : Definition 2 206 | 207 | { some code, part of Definition 2 } 208 | 209 | Third paragraph of definition 2. 210 | 211 | _Compact style:_ 212 | 213 | Term 1 214 | ~ Definition 1 215 | 216 | Term 2 217 | ~ Definition 2a 218 | ~ Definition 2b 219 | 220 | ### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr) 221 | 222 | This is HTML abbreviation example. 223 | 224 | It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. 225 | 226 | \*[HTML]: Hyper Text Markup Language 227 | 228 | ### [Custom containers](https://github.com/markdown-it/markdown-it-container) 229 | 230 | ::: warning 231 | _here be dragons_ 232 | ::: 233 | -------------------------------------------------------------------------------- /docs/The Adventure of the Six Napoleans.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filename 6 | 7 | 8 | 9 |

THE ADVENTURE OF THE SIX NAPOLEONS

10 |

11 | It was no very unusual thing for Mr. Lestrade, of Scotland Yard,to look in 12 | upon us of an evening, and his visits were welcome toSherlock Holmes, for 13 | they enabled him to keep in touch with allthat was going on at the police 14 | headquarters. In return for thenews which Lestrade would bring, Holmes was 15 | always ready tolisten with attention to the details of any case upon which 16 | thedetective was engaged, and was able occasionally, without anyactive 17 | interference, to give some hint or suggestion drawn fromhis own vast 18 | knowledge and experience. 19 |

20 |

21 | On this particular evening, Lestrade had spoken of the weatherand the 22 | newspapers. Then he had fallen silent, puffingthoughtfully at his cigar. 23 | Holmes looked keenly at him. 24 |

25 |

“Anything remarkable on hand?” he asked.

26 |

“Oh, no, Mr. Holmes—nothing very particular.”

27 |

“Then tell me about it.”

28 |

Lestrade laughed.

29 |

30 | “Well, Mr. Holmes, there is no use denying that there _is_something on my 31 | mind. And yet it is such an absurd business, thatI hesitated to bother you 32 | about it. On the other hand, althoughit is trivial, it is undoubtedly 33 | queer, and I know that you havea taste for all that is out of the common. 34 | But, in my opinion, itcomes more in Dr. Watson’s line than ours.” 35 |

36 |

“Disease?” said I.

37 |

38 | “Madness, anyhow. And a queer madness, too. You wouldn’t thinkthere was 39 | anyone living at this time of day who had such a hatredof Napoleon the 40 | First that he would break any image of him thathe could see.” 41 |

42 |

Holmes sank back in his chair.

43 |

“That’s no business of mine,” said he.

44 |

45 | “Exactly. That’s what I said. But then, when the man commitsburglary in 46 | order to break images which are not his own, thatbrings it away from the 47 | doctor and on to the policeman.” 48 |

49 |

Holmes sat up again.

50 |

“Burglary! This is more interesting. Let me hear the details.”

51 |

52 | Lestrade took out his official notebook and refreshed his memoryfrom its 53 | pages. 54 |

55 |

56 | “The first case reported was four days ago,” said he. “It was atthe shop 57 | of Morse Hudson, who has a place for the sale ofpictures and statues in 58 | the Kennington Road. The assistant hadleft the front shop for an instant, 59 | when he heard a crash, andhurrying in he found a plaster bust of Napoleon, 60 | which stood withseveral other works of art upon the counter, lying 61 | shivered intofragments. He rushed out into the road, but, although 62 | severalpassers-by declared that they had noticed a man run out of theshop, 63 | he could neither see anyone nor could he find any means ofidentifying the 64 | rascal. It seemed to be one of those senselessacts of hooliganism which 65 | occur from time to time, and it wasreported to the constable on the beat 66 | as such. The plaster castwas not worth more than a few shillings, and the 67 | whole affairappeared to be too childish for any particular investigation. 68 |

69 |

70 | “The second case, however, was more serious, and also moresingular. It 71 | occurred only last night. 72 |

73 |

74 | “In Kennington Road, and within a few hundred yards of MorseHudson’s shop, 75 | there lives a well-known medical practitioner,named Dr. Barnicot, who has 76 | one of the largest practices upon thesouth side of the Thames. His 77 | residence and principalconsulting-room is at Kennington Road, but he has a 78 | branchsurgery and dispensary at Lower Brixton Road, two miles away.This 79 | Dr. Barnicot is an enthusiastic admirer of Napoleon, and hishouse is full 80 | of books, pictures, and relics of the FrenchEmperor. Some little time ago 81 | he purchased from Morse Hudson twoduplicate plaster casts of the famous 82 | head of Napoleon by theFrench sculptor, Devine. One of these he placed in 83 | his hall inthe house at Kennington Road, and the other on the mantelpiece 84 | ofthe surgery at Lower Brixton. Well, when Dr. Barnicot came downthis 85 | morning he was astonished to find that his house had beenburgled during 86 | the night, but that nothing had been taken savethe plaster head from the 87 | hall. It had been carried out and hadbeen dashed savagely against the 88 | garden wall, under which itssplintered fragments were discovered.” 89 |

90 |

Holmes rubbed his hands.

91 |

“This is certainly very novel,” said he.

92 |

93 | “I thought it would please you. But I have not got to the endyet. Dr. 94 | Barnicot was due at his surgery at twelve o’clock, andyou can imagine his 95 | amazement when, on arriving there, he foundthat the window had been opened 96 | in the night and that the brokenpieces of his second bust were strewn all 97 | over the room. It hadbeen smashed to atoms where it stood. In neither case 98 | were thereany signs which could give us a clue as to the criminal 99 | orlunatic who had done the mischief. Now, Mr. Holmes, you have gotthe 100 | facts.” 101 |

102 |

103 | “They are singular, not to say grotesque,” said Holmes. “May Iask whether 104 | the two busts smashed in Dr. Barnicot’s rooms werethe exact duplicates of 105 | the one which was destroyed in MorseHudson’s shop?” 106 |

107 |

“They were taken from the same mould.”

108 |

109 | “Such a fact must tell against the theory that the man who breaksthem is 110 | influenced by any general hatred of Napoleon. Consideringhow many hundreds 111 | of statues of the great Emperor must exist inLondon, it is too much to 112 | suppose such a coincidence as that apromiscuous iconoclast should chance 113 | to begin upon threespecimens of the same bust.” 114 |

115 |

116 | “Well, I thought as you do,” said Lestrade. “On the other hand,this Morse 117 | Hudson is the purveyor of busts in that part ofLondon, and these three 118 | were the only ones which had been in hisshop for years. So, although, as 119 | you say, there are many hundredsof statues in London, it is very probable 120 | that these three werethe only ones in that district. Therefore, a local 121 | fanatic wouldbegin with them. What do you think, Dr. Watson?” 122 |

123 |

124 | “There are no limits to the possibilities of monomania,” Ianswered. “There 125 | is the condition which the modern Frenchpsychologists have called the 126 | _idée fixe_, which may be triflingin character, and accompanied by 127 | complete sanity in every otherway. A man who had read deeply about 128 | Napoleon, or who hadpossibly received some hereditary family injury 129 | through the greatwar, might conceivably form such an _idée fixe_ and under 130 | itsinfluence be capable of any fantastic outrage.” 131 |

132 |

133 | “That won’t do, my dear Watson,” said Holmes, shaking his head,“for no 134 | amount of _idée fixe_ would enable your interestingmonomaniac to find out 135 | where these busts were situated.” 136 |

137 |

“Well, how do _you_ explain it?”

138 |

139 | “I don’t attempt to do so. I would only observe that there is acertain 140 | method in the gentleman’s eccentric proceedings. Forexample, in Dr. 141 | Barnicot’s hall, where a sound might arouse thefamily, the bust was taken 142 | outside before being broken, whereasin the surgery, where there was less 143 | danger of an alarm, it wassmashed where it stood. The affair seems 144 | absurdly trifling, andyet I dare call nothing trivial when I reflect that 145 | some of mymost classic cases have had the least promising commencement. 146 | Youwill remember, Watson, how the dreadful business of the Abernettyfamily 147 | was first brought to my notice by the depth which theparsley had sunk into 148 | the butter upon a hot day. I can’t afford,therefore, to smile at your 149 | three broken busts, Lestrade, and Ishall be very much obliged to you if 150 | you will let me hear of anyfresh development of so singular a chain of 151 | events.” 152 |

153 |

154 | The development for which my friend had asked came in a quickerand an 155 | infinitely more tragic form than he could have imagined. Iwas still 156 | dressing in my bedroom next morning, when there was atap at the door and 157 | Holmes entered, a telegram in his hand. Heread it aloud: 158 |

159 |

“Come instantly, 131, Pitt Street, Kensington.—LESTRADE.”

160 |

“What is it, then?” I asked.

161 |

162 | “Don’t know—may be anything. But I suspect it is the sequel ofthe story of 163 | the statues. In that case our friend theimage-breaker has begun operations 164 | in another quarter of London.There’s coffee on the table, Watson, and I 165 | have a cab at thedoor.” 166 |

167 |

168 | In half an hour we had reached Pitt Street, a quiet littlebackwater just 169 | beside one of the briskest currents of Londonlife. No. 131 was one of a 170 | row, all flat-chested, respectable,and most unromantic dwellings. As we 171 | drove up, we found therailings in front of the house lined by a curious 172 | crowd. Holmeswhistled. 173 |

174 |

175 | “By George! It’s attempted murder at the least. Nothing less willhold the 176 | London message-boy. There’s a deed of violence indicatedin that fellow’s 177 | round shoulders and outstretched neck. What’sthis, Watson? The top steps 178 | swilled down and the other ones dry.Footsteps enough, anyhow! Well, well, 179 | there’s Lestrade at thefront window, and we shall soon know all about it.” 180 |

181 |

182 | The official received us with a very grave face and showed usinto a 183 | sitting-room, where an exceedingly unkempt and agitatedelderly man, clad 184 | in a flannel dressing-gown, was pacing up anddown. He was introduced to us 185 | as the owner of the house—Mr.Horace Harker, of the Central Press 186 | Syndicate. 187 |

188 |

189 | “It’s the Napoleon bust business again,” said Lestrade. “Youseemed 190 | interested last night, Mr. Holmes, so I thought perhapsyou would be glad 191 | to be present now that the affair has taken avery much graver turn.” 192 |

193 |

“What has it turned to, then?”

194 |

195 | “To murder. Mr. Harker, will you tell these gentlemen exactlywhat has 196 | occurred?” 197 |

198 |

199 | The man in the dressing-gown turned upon us with a mostmelancholy face. 200 |

201 |

202 | “It’s an extraordinary thing,” said he, “that all my life I havebeen 203 | collecting other people’s news, and now that a real piece ofnews has come 204 | my own way I am so confused and bothered that Ican’t put two words 205 | together. If I had come in here as ajournalist, I should have interviewed 206 | myself and had two columnsin every evening paper. As it is, I am giving 207 | away valuable copyby telling my story over and over to a string of 208 | differentpeople, and I can make no use of it myself. However, I’ve 209 | heardyour name, Mr. Sherlock Holmes, and if you’ll only explain thisqueer 210 | business, I shall be paid for my trouble in telling you thestory.” 211 |

212 |

Holmes sat down and listened.

213 |

214 | “It all seems to centre round that bust of Napoleon which Ibought for this 215 | very room about four months ago. I picked it upcheap from Harding 216 | Brothers, two doors from the High StreetStation. A great deal of my 217 | journalistic work is done at night,and I often write until the early 218 | morning. So it was to-day. Iwas sitting in my den, which is at the back of 219 | the top of thehouse, about three o’clock, when I was convinced that I 220 | heardsome sounds downstairs. I listened, but they were not repeated,and I 221 | concluded that they came from outside. Then suddenly, aboutfive minutes 222 | later, there came a most horrible yell—the mostdreadful sound, Mr. Holmes, 223 | that ever I heard. It will ring in myears as long as I live. I sat frozen 224 | with horror for a minute ortwo. Then I seized the poker and went 225 | downstairs. When I enteredthis room I found the window wide open, and I at 226 | once observedthat the bust was gone from the mantelpiece. Why any 227 | burglarshould take such a thing passes my understanding, for it was onlya 228 | plaster cast and of no real value whatever. 229 |

230 |

231 | “You can see for yourself that anyone going out through that openwindow 232 | could reach the front doorstep by taking a long stride.This was clearly 233 | what the burglar had done, so I went round andopened the door. Stepping 234 | out into the dark, I nearly fell over adead man, who was lying there. I 235 | ran back for a light and therewas the poor fellow, a great gash in his 236 | throat and the wholeplace swimming in blood. He lay on his back, his knees 237 | drawn up,and his mouth horribly open. I shall see him in my dreams. I 238 | hadjust time to blow on my police-whistle, and then I must havefainted, 239 | for I knew nothing more until I found the policemanstanding over me in the 240 | hall.” 241 |

242 |

“Well, who was the murdered man?” asked Holmes.

243 |

244 | “There’s nothing to show who he was,” said Lestrade. “You shallsee the 245 | body at the mortuary, but we have made nothing of it upto now. He is a 246 | tall man, sunburned, very powerful, not more thanthirty. He is poorly 247 | dressed, and yet does not appear to be alabourer. A horn-handled clasp 248 | knife was lying in a pool of bloodbeside him. Whether it was the weapon 249 | which did the deed, orwhether it belonged to the dead man, I do not know. 250 | There was noname on his clothing, and nothing in his pockets save an 251 | apple,some string, a shilling map of London, and a photograph. Here itis.” 252 |

253 |

254 | It was evidently taken by a snapshot from a small camera. Itrepresented an 255 | alert, sharp-featured simian man, with thickeyebrows and a very peculiar 256 | projection of the lower part of theface, like the muzzle of a baboon. 257 |

258 |

259 | “And what became of the bust?” asked Holmes, after a carefulstudy of this 260 | picture. 261 |

262 |

263 | “We had news of it just before you came. It has been found in thefront 264 | garden of an empty house in Campden House Road. It wasbroken into 265 | fragments. I am going round now to see it. Will youcome?” 266 |

267 |

268 | “Certainly. I must just take one look round.” He examined thecarpet and 269 | the window. “The fellow had either very long legs orwas a most active 270 | man,” said he. “With an area beneath, it was nomean feat to reach that 271 | window ledge and open that window.Getting back was comparatively simple. 272 | Are you coming with us tosee the remains of your bust, Mr. Harker?” 273 |

274 |

The disconsolate journalist had seated himself at awriting-table.

275 |

276 | “I must try and make something of it,” said he, “though I have nodoubt 277 | that the first editions of the evening papers are outalready with full 278 | details. It’s like my luck! You remember whenthe stand fell at Doncaster? 279 | Well, I was the only journalist inthe stand, and my journal the only one 280 | that had no account of it,for I was too shaken to write it. And now I’ll 281 | be too late with amurder done on my own doorstep.” 282 |

283 |

284 | As we left the room, we heard his pen travelling shrilly over thefoolscap. 285 |

286 |

287 | The spot where the fragments of the bust had been found was onlya few 288 | hundred yards away. For the first time our eyes rested uponthis 289 | presentment of the great emperor, which seemed to raise suchfrantic and 290 | destructive hatred in the mind of the unknown. It layscattered, in 291 | splintered shards, upon the grass. Holmes picked upseveral of them and 292 | examined them carefully. I was convinced,from his intent face and his 293 | purposeful manner, that at last hewas upon a clue. 294 |

295 |

“Well?” asked Lestrade.

296 |

Holmes shrugged his shoulders.

297 |

298 | “We have a long way to go yet,” said he. “And yet—and yet—well,we have 299 | some suggestive facts to act upon. The possession of thistrifling bust was 300 | worth more, in the eyes of this strangecriminal, than a human life. That 301 | is one point. Then there is thesingular fact that he did not break it in 302 | the house, orimmediately outside the house, if to break it was his 303 | soleobject.” 304 |

305 |

306 | “He was rattled and bustled by meeting this other fellow. Hehardly knew 307 | what he was doing.” 308 |

309 |

310 | “Well, that’s likely enough. But I wish to call your attentionvery 311 | particularly to the position of this house, in the garden ofwhich the bust 312 | was destroyed.” 313 |

314 |

Lestrade looked about him.

315 |

316 | “It was an empty house, and so he knew that he would not bedisturbed in 317 | the garden.” 318 |

319 |

320 | “Yes, but there is another empty house farther up the streetwhich he must 321 | have passed before he came to this one. Why did henot break it there, 322 | since it is evident that every yard that hecarried it increased the risk 323 | of someone meeting him?” 324 |

325 |

“I give it up,” said Lestrade.

326 |

Holmes pointed to the street lamp above our heads.

327 |

328 | “He could see what he was doing here, and he could not there.That was his 329 | reason.” 330 |

331 |

332 | “By Jove! that’s true,” said the detective. “Now that I come tothink of 333 | it, Dr. Barnicot’s bust was broken not far from his redlamp. Well, Mr. 334 | Holmes, what are we to do with that fact?” 335 |

336 |

337 | “To remember it—to docket it. We may come on something laterwhich will 338 | bear upon it. What steps do you propose to take now,Lestrade?” 339 |

340 |

341 | “The most practical way of getting at it, in my opinion, is toidentify the 342 | dead man. There should be no difficulty about that.When we have found who 343 | he is and who his associates are, weshould have a good start in learning 344 | what he was doing in PittStreet last night, and who it was who met him and 345 | killed him onthe doorstep of Mr. Horace Harker. Don’t you think so?” 346 |

347 |

348 | “No doubt; and yet it is not quite the way in which I shouldapproach the 349 | case.” 350 |

351 |

“What would you do then?”

352 |

353 | “Oh, you must not let me influence you in any way. I suggest thatyou go on 354 | your line and I on mine. We can compare notesafterwards, and each will 355 | supplement the other.” 356 |

357 |

“Very good,” said Lestrade.

358 |

359 | “If you are going back to Pitt Street, you might see Mr. HoraceHarker. 360 | Tell him for me that I have quite made up my mind, andthat it is certain 361 | that a dangerous homicidal lunatic, withNapoleonic delusions, was in his 362 | house last night. It will beuseful for his article.” 363 |

364 |

Lestrade stared.

365 |

“You don’t seriously believe that?”

366 |

Holmes smiled.

367 |

368 | “Don’t I? Well, perhaps I don’t. But I am sure that it willinterest Mr. 369 | Horace Harker and the subscribers of the CentralPress Syndicate. Now, 370 | Watson, I think that we shall find that wehave a long and rather complex 371 | day’s work before us. I should beglad, Lestrade, if you could make it 372 | convenient to meet us atBaker Street at six o’clock this evening. Until 373 | then I shouldlike to keep this photograph, found in the dead man’s pocket. 374 | Itis possible that I may have to ask your company and assistanceupon a 375 | small expedition which will have be undertaken to-night,if my chain of 376 | reasoning should prove to be correct. Until thengood-bye and good luck!” 377 |

378 |

379 | Sherlock Holmes and I walked together to the High Street, wherewe stopped 380 | at the shop of Harding Brothers, whence the bust hadbeen purchased. A 381 | young assistant informed us that Mr. Hardingwould be absent until 382 | afternoon, and that he was himself anewcomer, who could give us no 383 | information. Holmes’s face showedhis disappointment and annoyance. 384 |

385 |

386 | “Well, well, we can’t expect to have it all our own way, Watson,”he said, 387 | at last. “We must come back in the afternoon, if Mr.Harding will not be 388 | here until then. I am, as you have no doubtsurmised, endeavouring to trace 389 | these busts to their source, inorder to find if there is not something 390 | peculiar which mayaccount for their remarkable fate. Let us make for Mr. 391 | MorseHudson, of the Kennington Road, and see if he can throw any lightupon 392 | the problem.” 393 |

394 |

395 | A drive of an hour brought us to the picture-dealer’sestablishment. He was 396 | a small, stout man with a red face and apeppery manner. 397 |

398 |

399 | “Yes, sir. On my very counter, sir,” said he. “What we pay ratesand taxes 400 | for I don’t know, when any ruffian can come in andbreak one’s goods. Yes, 401 | sir, it was I who sold Dr. Barnicot histwo statues. Disgraceful, sir! A 402 | Nihilist plot—that’s what I makeit. No one but an anarchist would go about 403 | breaking statues. Redrepublicans—that’s what I call ’em. Who did I get the 404 | statuesfrom? I don’t see what that has to do with it. Well, if youreally 405 | want to know, I got them from Gelder & Co., in ChurchStreet, Stepney. They 406 | are a well-known house in the trade, andhave been this twenty years. How 407 | many had I? Three—two and oneare three—two of Dr. Barnicot’s, and one 408 | smashed in broaddaylight on my own counter. Do I know that photograph? No, 409 | Idon’t. Yes, I do, though. Why, it’s Beppo. He was a kind ofItalian 410 | piece-work man, who made himself useful in the shop. Hecould carve a bit, 411 | and gild and frame, and do odd jobs. Thefellow left me last week, and I’ve 412 | heard nothing of him since.No, I don’t know where he came from nor where 413 | he went to. I hadnothing against him while he was here. He was gone two 414 | daysbefore the bust was smashed.” 415 |

416 |

417 | “Well, that’s all we could reasonably expect from Morse Hudson,”said 418 | Holmes, as we emerged from the shop. “We have this Beppo asa common 419 | factor, both in Kennington and in Kensington, so that isworth a ten-mile 420 | drive. Now, Watson, let us make for Gelder &Co., of Stepney, the source 421 | and origin of the busts. I shall besurprised if we don’t get some help 422 | down there.” 423 |

424 |

425 | In rapid succession we passed through the fringe of fashionableLondon, 426 | hotel London, theatrical London, literary London,commercial London, and, 427 | finally, maritime London, till we came toa riverside city of a hundred 428 | thousand souls, where the tenementhouses swelter and reek with the 429 | outcasts of Europe. Here, in abroad thoroughfare, once the abode of 430 | wealthy City merchants, wefound the sculpture works for which we searched. 431 | Outside was aconsiderable yard full of monumental masonry. Inside was a 432 | largeroom in which fifty workers were carving or moulding. Themanager, a 433 | big blond German, received us civilly and gave a clearanswer to all 434 | Holmes’s questions. A reference to his books showedthat hundreds of casts 435 | had been taken from a marble copy ofDevine’s head of Napoleon, but that 436 | the three which had been sentto Morse Hudson a year or so before had been 437 | half of a batch ofsix, the other three being sent to Harding Brothers, 438 | ofKensington. There was no reason why those six should be differentfrom 439 | any of the other casts. He could suggest no possible causewhy anyone 440 | should wish to destroy them—in fact, he laughed at theidea. Their 441 | wholesale price was six shillings, but the retailerwould get twelve or 442 | more. The cast was taken in two moulds fromeach side of the face, and then 443 | these two profiles of plaster ofParis were joined together to make the 444 | complete bust. The workwas usually done by Italians, in the room we were 445 | in. Whenfinished, the busts were put on a table in the passage to dry,and 446 | afterwards stored. That was all he could tell us. 447 |

448 |

449 | But the production of the photograph had a remarkable effect uponthe 450 | manager. His face flushed with anger, and his brows knottedover his blue 451 | Teutonic eyes. 452 |

453 |

454 | “Ah, the rascal!” he cried. “Yes, indeed, I know him very well.This has 455 | always been a respectable establishment, and the onlytime that we have 456 | ever had the police in it was over this veryfellow. It was more than a 457 | year ago now. He knifed anotherItalian in the street, and then he came to 458 | the works with thepolice on his heels, and he was taken here. Beppo was 459 | hisname—his second name I never knew. Serve me right for engaging aman 460 | with such a face. But he was a good workman—one of the best.” 461 |

462 |

“What did he get?”

463 |

464 | “The man lived and he got off with a year. I have no doubt he isout now, 465 | but he has not dared to show his nose here. We have acousin of his here, 466 | and I daresay he could tell you where he is.” 467 |

468 |

469 | “No, no,” cried Holmes, “not a word to the cousin—not a word, Ibeg of you. 470 | The matter is very important, and the farther I gowith it, the more 471 | important it seems to grow. When you referredin your ledger to the sale of 472 | those casts I observed that thedate was June 3rd of last year. Could you 473 | give me the date whenBeppo was arrested?” 474 |

475 |

476 | “I could tell you roughly by the pay-list,” the manager answered.“Yes,” he 477 | continued, after some turning over of pages, “he waspaid last on May 478 | 20th.” 479 |

480 |

481 | “Thank you,” said Holmes. “I don’t think that I need intrude uponyour time 482 | and patience any more.” With a last word of cautionthat he should say 483 | nothing as to our researches, we turned ourfaces westward once more. 484 |

485 |

486 | The afternoon was far advanced before we were able to snatch ahasty 487 | luncheon at a restaurant. A news-bill at the entranceannounced “Kensington 488 | Outrage. Murder by a Madman,” and thecontents of the paper showed that Mr. 489 | Horace Harker had got hisaccount into print after all. Two columns were 490 | occupied with ahighly sensational and flowery rendering of the whole 491 | incident.Holmes propped it against the cruet-stand and read it while 492 | heate. Once or twice he chuckled. 493 |

494 |

“This is all right, Watson,” said he. “Listen to this:

495 |

496 | “It is satisfactory to know that there can be no difference ofopinion upon 497 | this case, since Mr. Lestrade, one of the mostexperienced members of the 498 | official force, and Mr. SherlockHolmes, the well-known consulting expert, 499 | have each come to theconclusion that the grotesque series of incidents, 500 | which haveended in so tragic a fashion, arise from lunacy rather than 501 | fromdeliberate crime. No explanation save mental aberration can coverthe 502 | facts. 503 |

504 |

505 | “The Press, Watson, is a most valuable institution, if you onlyknow how to 506 | use it. And now, if you have quite finished, we willhark back to 507 | Kensington and see what the manager of HardingBrothers has to say on the 508 | matter.” 509 |

510 |

511 | The founder of that great emporium proved to be a brisk, crisplittle 512 | person, very dapper and quick, with a clear head and aready tongue. 513 |

514 |

515 | “Yes, sir, I have already read the account in the evening papers.Mr. 516 | Horace Harker is a customer of ours. We supplied him with thebust some 517 | months ago. We ordered three busts of that sort fromGelder & Co., of 518 | Stepney. They are all sold now. To whom? Oh, Idaresay by consulting our 519 | sales book we could very easily tellyou. Yes, we have the entries here. 520 | One to Mr. Harker you see,and one to Mr. Josiah Brown, of Laburnum Lodge, 521 | Laburnum Vale,Chiswick, and one to Mr. Sandeford, of Lower Grove Road, 522 | Reading.No, I have never seen this face which you show me in 523 | thephotograph. You would hardly forget it, would you, sir, for I’veseldom 524 | seen an uglier. Have we any Italians on the staff? Yes,sir, we have 525 | several among our workpeople and cleaners. I daresaythey might get a peep 526 | at that sales book if they wanted to. Thereis no particular reason for 527 | keeping a watch upon that book. Well,well, it’s a very strange business, 528 | and I hope that you will letme know if anything comes of your inquiries.” 529 |

530 |

531 | Holmes had taken several notes during Mr. Harding’s evidence, andI could 532 | see that he was thoroughly satisfied by the turn whichaffairs were taking. 533 | He made no remark, however, save that,unless we hurried, we should be late 534 | for our appointment withLestrade. Sure enough, when we reached Baker 535 | Street the detectivewas already there, and we found him pacing up and down 536 | in a feverof impatience. His look of importance showed that his day’s 537 | workhad not been in vain. 538 |

539 |

“Well?” he asked. “What luck, Mr. Holmes?”

540 |

541 | “We have had a very busy day, and not entirely a wasted one,” myfriend 542 | explained. “We have seen both the retailers and also thewholesale 543 | manufacturers. I can trace each of the busts now fromthe beginning.” 544 |

545 |

546 | “The busts,” cried Lestrade. “Well, well, you have your ownmethods, Mr. 547 | Sherlock Holmes, and it is not for me to say a wordagainst them, but I 548 | think I have done a better day’s work thanyou. I have identified the dead 549 | man.” 550 |

551 |

“You don’t say so?”

552 |

“And found a cause for the crime.”

553 |

“Splendid!”

554 |

555 | “We have an inspector who makes a specialty of Saffron Hill andthe Italian 556 | Quarter. Well, this dead man had some Catholic emblemround his neck, and 557 | that, along with his colour, made me think hewas from the South. Inspector 558 | Hill knew him the moment he caughtsight of him. His name is Pietro 559 | Venucci, from Naples, and he isone of the greatest cut-throats in London. 560 | He is connected withthe Mafia, which, as you know, is a secret political 561 | society,enforcing its decrees by murder. Now, you see how the affairbegins 562 | to clear up. The other fellow is probably an Italian also,and a member of 563 | the Mafia. He has broken the rules in somefashion. Pietro is set upon his 564 | track. Probably the photograph wefound in his pocket is the man himself, 565 | so that he may not knifethe wrong person. He dogs the fellow, he sees him 566 | enter a house,he waits outside for him, and in the scuffle he receives his 567 | owndeath-wound. How is that, Mr. Sherlock Holmes?” 568 |

569 |

Holmes clapped his hands approvingly.

570 |

571 | “Excellent, Lestrade, excellent!” he cried. “But I didn’t quitefollow your 572 | explanation of the destruction of the busts.” 573 |

574 |

575 | “The busts! You never can get those busts out of your head. Afterall, that 576 | is nothing; petty larceny, six months at the most. Itis the murder that we 577 | are really investigating, and I tell youthat I am gathering all the 578 | threads into my hands.” 579 |

580 |

“And the next stage?”

581 |

582 | “Is a very simple one. I shall go down with Hill to the ItalianQuarter, 583 | find the man whose photograph we have got, and arresthim on the charge of 584 | murder. Will you come with us?” 585 |

586 |

587 | “I think not. I fancy we can attain our end in a simpler way. Ican’t say 588 | for certain, because it all depends—well, it alldepends upon a factor 589 | which is completely outside our control.But I have great hopes—in fact, 590 | the betting is exactly two toone—that if you will come with us to-night I 591 | shall be able tohelp you to lay him by the heels.” 592 |

593 |

“In the Italian Quarter?”

594 |

595 | “No, I fancy Chiswick is an address which is more likely to findhim. If 596 | you will come with me to Chiswick to-night, Lestrade,I’ll promise to go to 597 | the Italian Quarter with you to-morrow, andno harm will be done by the 598 | delay. And now I think that a fewhours’ sleep would do us all good, for I 599 | do not propose to leavebefore eleven o’clock, and it is unlikely that we 600 | shall be backbefore morning. You’ll dine with us, Lestrade, and then you 601 | arewelcome to the sofa until it is time for us to start. In themeantime, 602 | Watson, I should be glad if you would ring for anexpress messenger, for I 603 | have a letter to send and it isimportant that it should go at once.” 604 |

605 |

606 | Holmes spent the evening in rummaging among the files of the olddaily 607 | papers with which one of our lumber-rooms was packed. Whenat last he 608 | descended, it was with triumph in his eyes, but hesaid nothing to either 609 | of us as to the result of his researches.For my own part, I had followed 610 | step by step the methods by whichhe had traced the various windings of 611 | this complex case, and,though I could not yet perceive the goal which we 612 | would reach, Iunderstood clearly that Holmes expected this grotesque 613 | criminalto make an attempt upon the two remaining busts, one of which, 614 | Iremembered, was at Chiswick. No doubt the object of our journeywas to 615 | catch him in the very act, and I could not but admire thecunning with 616 | which my friend had inserted a wrong clue in theevening paper, so as to 617 | give the fellow the idea that he couldcontinue his scheme with impunity. I 618 | was not surprised whenHolmes suggested that I should take my revolver with 619 | me. He hadhimself picked up the loaded hunting-crop, which was 620 | hisfavourite weapon. 621 |

622 |

623 | A four-wheeler was at the door at eleven, and in it we drove to aspot at 624 | the other side of Hammersmith Bridge. Here the cabman wasdirected to wait. 625 | A short walk brought us to a secluded roadfringed with pleasant houses, 626 | each standing in its own grounds.In the light of a street lamp we read 627 | “Laburnum Villa” upon thegate-post of one of them. The occupants had 628 | evidently retired torest, for all was dark save for a fanlight over the 629 | hall door,which shed a single blurred circle on to the garden path. 630 | Thewooden fence which separated the grounds from the road threw adense 631 | black shadow upon the inner side, and here it was that wecrouched. 632 |

633 |

634 | “I fear that you’ll have a long wait,” Holmes whispered. “We maythank our 635 | stars that it is not raining. I don’t think we can evenventure to smoke to 636 | pass the time. However, it’s a two to onechance that we get something to 637 | pay us for our trouble.” 638 |

639 |

640 | It proved, however, that our vigil was not to be so long asHolmes had led 641 | us to fear, and it ended in a very sudden andsingular fashion. In an 642 | instant, without the least sound to warnus of his coming, the garden gate 643 | swung open, and a lithe, darkfigure, as swift and active as an ape, rushed 644 | up the garden path.We saw it whisk past the light thrown from over the 645 | door anddisappear against the black shadow of the house. There was a 646 | longpause, during which we held our breath, and then a very gentlecreaking 647 | sound came to our ears. The window was being opened. Thenoise ceased, and 648 | again there was a long silence. The fellow wasmaking his way into the 649 | house. We saw the sudden flash of a darklantern inside the room. What he 650 | sought was evidently not there,for again we saw the flash through another 651 | blind, and thenthrough another. 652 |

653 |

654 | “Let us get to the open window. We will nab him as he climbsout,” Lestrade 655 | whispered. 656 |

657 |

658 | But before we could move, the man had emerged again. As he cameout into 659 | the glimmering patch of light, we saw that he carriedsomething white under 660 | his arm. He looked stealthily all roundhim. The silence of the deserted 661 | street reassured him. Turninghis back upon us he laid down his burden, and 662 | the next instantthere was the sound of a sharp tap, followed by a clatter 663 | andrattle. The man was so intent upon what he was doing that henever heard 664 | our steps as we stole across the grass plot. With thebound of a tiger 665 | Holmes was on his back, and an instant laterLestrade and I had him by 666 | either wrist, and the handcuffs hadbeen fastened. As we turned him over I 667 | saw a hideous, sallowface, with writhing, furious features, glaring up at 668 | us, and Iknew that it was indeed the man of the photograph whom we 669 | hadsecured. 670 |

671 |

672 | But it was not our prisoner to whom Holmes was giving hisattention. 673 | Squatted on the doorstep, he was engaged in mostcarefully examining that 674 | which the man had brought from thehouse. It was a bust of Napoleon, like 675 | the one which we had seenthat morning, and it had been broken into similar 676 | fragments.Carefully Holmes held each separate shard to the light, but in 677 | noway did it differ from any other shattered piece of plaster. Hehad just 678 | completed his examination when the hall lights flew up,the door opened, 679 | and the owner of the house, a jovial, rotundfigure in shirt and trousers, 680 | presented himself. 681 |

682 |

“Mr. Josiah Brown, I suppose?” said Holmes.

683 |

684 | “Yes, sir; and you, no doubt, are Mr. Sherlock Holmes? I had thenote which 685 | you sent by the express messenger, and I did exactlywhat you told me. We 686 | locked every door on the inside and awaiteddevelopments. Well, I’m very 687 | glad to see that you have got therascal. I hope, gentlemen, that you will 688 | come in and have somerefreshment.” 689 |

690 |

691 | However, Lestrade was anxious to get his man into safe quarters,so within 692 | a few minutes our cab had been summoned and we were allfour upon our way 693 | to London. Not a word would our captive say,but he glared at us from the 694 | shadow of his matted hair, and once,when my hand seemed within his reach, 695 | he snapped at it like ahungry wolf. We stayed long enough at the 696 | police-station to learnthat a search of his clothing revealed nothing save 697 | a fewshillings and a long sheath knife, the handle of which borecopious 698 | traces of recent blood. 699 |

700 |

701 | “That’s all right,” said Lestrade, as we parted. “Hill knows allthese 702 | gentry, and he will give a name to him. You’ll find that mytheory of the 703 | Mafia will work out all right. But I’m sure I amexceedingly obliged to 704 | you, Mr. Holmes, for the workmanlike wayin which you laid hands upon him. 705 | I don’t quite understand it allyet.” 706 |

707 |

708 | “I fear it is rather too late an hour for explanations,” saidHolmes. 709 | “Besides, there are one or two details which are notfinished off, and it 710 | is one of those cases which are worthworking out to the very end. If you 711 | will come round once more tomy rooms at six o’clock to-morrow, I think I 712 | shall be able toshow you that even now you have not grasped the entire 713 | meaning ofthis business, which presents some features which make 714 | itabsolutely original in the history of crime. If ever I permit youto 715 | chronicle any more of my little problems, Watson, I foreseethat you will 716 | enliven your pages by an account of the singularadventure of the 717 | Napoleonic busts.” 718 |

719 |

720 | When we met again next evening, Lestrade was furnished with 721 | muchinformation concerning our prisoner. His name, it appeared, wasBeppo, 722 | second name unknown. He was a well-known ne’er-do-wellamong the Italian 723 | colony. He had once been a skilful sculptor andhad earned an honest 724 | living, but he had taken to evil courses andhad twice already been in 725 | jail—once for a petty theft, and once,as we had already heard, for 726 | stabbing a fellow-countryman. Hecould talk English perfectly well. His 727 | reasons for destroying thebusts were still unknown, and he refused to 728 | answer any questionsupon the subject, but the police had discovered that 729 | these samebusts might very well have been made by his own hands, since 730 | hewas engaged in this class of work at the establishment of Gelder& Co. To 731 | all this information, much of which we already knew,Holmes listened with 732 | polite attention, but I, who knew him sowell, could clearly see that his 733 | thoughts were elsewhere, and Idetected a mixture of mingled uneasiness and 734 | expectation beneaththat mask which he was wont to assume. At last he 735 | started in hischair, and his eyes brightened. There had been a ring at 736 | thebell. A minute later we heard steps upon the stairs, and anelderly 737 | red-faced man with grizzled side-whiskers was ushered in.In his right hand 738 | he carried an old-fashioned carpet-bag, whichhe placed upon the table. 739 |

740 |

“Is Mr. Sherlock Holmes here?”

741 |

742 | My friend bowed and smiled. “Mr. Sandeford, of Reading, Isuppose?” said 743 | he. 744 |

745 |

746 | “Yes, sir, I fear that I am a little late, but the trains wereawkward. You 747 | wrote to me about a bust that is in my possession.” 748 |

749 |

“Exactly.”

750 |

751 | “I have your letter here. You said, ‘I desire to possess a copyof Devine’s 752 | Napoleon, and am prepared to pay you ten pounds forthe one which is in 753 | your possession.’ Is that right?” 754 |

755 |

“Certainly.”

756 |

757 | “I was very much surprised at your letter, for I could notimagine how you 758 | knew that I owned such a thing.” 759 |

760 |

761 | “Of course you must have been surprised, but the explanation isvery 762 | simple. Mr. Harding, of Harding Brothers, said that they hadsold you their 763 | last copy, and he gave me your address.” 764 |

765 |

“Oh, that was it, was it? Did he tell you what I paid for it?”

766 |

“No, he did not.”

767 |

768 | “Well, I am an honest man, though not a very rich one. I onlygave fifteen 769 | shillings for the bust, and I think you ought toknow that before I take 770 | ten pounds from you. 771 |

772 |

773 | “I am sure the scruple does you honour, Mr. Sandeford. But I havenamed 774 | that price, so I intend to stick to it.” 775 |

776 |

777 | “Well, it is very handsome of you, Mr. Holmes. I brought the bustup with 778 | me, as you asked me to do. Here it is!” He opened hisbag, and at last we 779 | saw placed upon our table a complete specimenof that bust which we had 780 | already seen more than once infragments. 781 |

782 |

783 | Holmes took a paper from his pocket and laid a ten-pound noteupon the 784 | table. 785 |

786 |

787 | “You will kindly sign that paper, Mr. Sandeford, in the presenceof these 788 | witnesses. It is simply to say that you transfer everypossible right that 789 | you ever had in the bust to me. I am amethodical man, you see, and you 790 | never know what turn eventsmight take afterwards. Thank you, Mr. 791 | Sandeford; here is yourmoney, and I wish you a very good evening.” 792 |

793 |

794 | When our visitor had disappeared, Sherlock Holmes’s movementswere such as 795 | to rivet our attention. He began by taking a cleanwhite cloth from a 796 | drawer and laying it over the table. Then heplaced his newly acquired bust 797 | in the centre of the cloth.Finally, he picked up his hunting-crop and 798 | struck Napoleon asharp blow on the top of the head. The figure broke 799 | intofragments, and Holmes bent eagerly over the shattered remains.Next 800 | instant, with a loud shout of triumph he held up onesplinter, in which a 801 | round, dark object was fixed like a plum ina pudding. 802 |

803 |

804 | “Gentlemen,” he cried, “let me introduce you to the famous blackpearl of 805 | the Borgias.” 806 |

807 |

808 | Lestrade and I sat silent for a moment, and then, with aspontaneous 809 | impulse, we both broke at clapping, as at thewell-wrought crisis of a 810 | play. A flush of colour sprang toHolmes’s pale cheeks, and he bowed to us 811 | like the masterdramatist who receives the homage of his audience. It was 812 | at suchmoments that for an instant he ceased to be a reasoning machine,and 813 | betrayed his human love for admiration and applause. The samesingularly 814 | proud and reserved nature which turned away withdisdain from popular 815 | notoriety was capable of being moved to itsdepths by spontaneous wonder 816 | and praise from a friend. 817 |

818 |

819 | “Yes, gentlemen,” said he, “it is the most famous pearl nowexisting in the 820 | world, and it has been my good fortune, by aconnected chain of inductive 821 | reasoning, to trace it from thePrince of Colonna’s bedroom at the Dacre 822 | Hotel, where it waslost, to the interior of this, the last of the six 823 | busts ofNapoleon which were manufactured by Gelder & Co., of Stepney. 824 | Youwill remember, Lestrade, the sensation caused by thedisappearance of 825 | this valuable jewel and the vain efforts of theLondon police to recover 826 | it. I was myself consulted upon thecase, but I was unable to throw any 827 | light upon it. Suspicion fellupon the maid of the Princess, who was an 828 | Italian, and it wasproved that she had a brother in London, but we failed 829 | to traceany connection between them. The maid’s name was LucretiaVenucci, 830 | and there is no doubt in my mind that this Pietro whowas murdered two 831 | nights ago was the brother. I have been lookingup the dates in the old 832 | files of the paper, and I find that thedisappearance of the pearl was 833 | exactly two days before the arrestof Beppo, for some crime of violence—an 834 | event which took place inthe factory of Gelder & Co., at the very moment 835 | when these bustswere being made. Now you clearly see the sequence of 836 | events,though you see them, of course, in the inverse order to the wayin 837 | which they presented themselves to me. Beppo had the pearl inhis 838 | possession. He may have stolen it from Pietro, he may havebeen Pietro’s 839 | confederate, he may have been the go-between ofPietro and his sister. It 840 | is of no consequence to us which is thecorrect solution. 841 |

842 |

843 | “The main fact is that he _had_ the pearl, and at that moment,when it was 844 | on his person, he was pursued by the police. He madefor the factory in 845 | which he worked, and he knew that he had onlya few minutes in which to 846 | conceal this enormously valuable prize,which would otherwise be found on 847 | him when he was searched. Sixplaster casts of Napoleon were drying in the 848 | passage. One of themwas still soft. In an instant Beppo, a skilful 849 | workman, made asmall hole in the wet plaster, dropped in the pearl, and 850 | with afew touches covered over the aperture once more. It was anadmirable 851 | hiding-place. No one could possibly find it. But Beppowas condemned to a 852 | year’s imprisonment, and in the meanwhile hissix busts were scattered over 853 | London. He could not tell whichcontained his treasure. Only by breaking 854 | them could he see. Evenshaking would tell him nothing, for as the plaster 855 | was wet it wasprobable that the pearl would adhere to it—as, in fact, it 856 | hasdone. Beppo did not despair, and he conducted his search 857 | withconsiderable ingenuity and perseverance. Through a cousin whoworks 858 | with Gelder, he found out the retail firms who had boughtthe busts. He 859 | managed to find employment with Morse Hudson, andin that way tracked down 860 | three of them. The pearl was not there.Then, with the help of some Italian 861 | employee, he succeeded infinding out where the other three busts had gone. 862 | The first wasat Harker’s. There he was dogged by his confederate, who 863 | heldBeppo responsible for the loss of the pearl, and he stabbed himin the 864 | scuffle which followed.” 865 |

866 |

867 | “If he was his confederate, why should he carry his photograph?”I asked. 868 |

869 |

870 | “As a means of tracing him, if he wished to inquire about himfrom any 871 | third person. That was the obvious reason. Well, afterthe murder I 872 | calculated that Beppo would probably hurry ratherthan delay his movements. 873 | He would fear that the police wouldread his secret, and so he hastened on 874 | before they should getahead of him. Of course, I could not say that he had 875 | not foundthe pearl in Harker’s bust. I had not even concluded for 876 | certainthat it was the pearl, but it was evident to me that he waslooking 877 | for something, since he carried the bust past the otherhouses in order to 878 | break it in the garden which had a lampoverlooking it. Since Harker’s bust 879 | was one in three, the chanceswere exactly as I told you—two to one against 880 | the pearl beinginside it. There remained two busts, and it was obvious 881 | that hewould go for the London one first. I warned the inmates of 882 | thehouse, so as to avoid a second tragedy, and we went down, withthe 883 | happiest results. By that time, of course, I knew for certainthat it was 884 | the Borgia pearl that we were after. The name of themurdered man linked 885 | the one event with the other. There onlyremained a single bust—the Reading 886 | one—and the pearl must bethere. I bought it in your presence from the 887 | owner—and there itlies.” 888 |

889 |

We sat in silence for a moment.

890 |

891 | “Well,” said Lestrade, “I’ve seen you handle a good many cases,Mr. Holmes, 892 | but I don’t know that I ever knew a more workmanlikeone than that. We’re 893 | not jealous of you at Scotland Yard. No,sir, we are very proud of you, and 894 | if you come down to-morrow,there’s not a man, from the oldest inspector to 895 | the youngestconstable, who wouldn’t be glad to shake you by the hand.” 896 |

897 |

898 | “Thank you!” said Holmes. “Thank you!” and as he turned away, itseemed to 899 | me that he was more nearly moved by the softer humanemotions than I had 900 | ever seen him. A moment later he was the coldand practical thinker once 901 | more. “Put the pearl in the safe,Watson,” said he, “and get out the papers 902 | of the Conk-Singletonforgery case. Good-bye, Lestrade. If any little 903 | problem comesyour way, I shall be happy, if I can, to give you a hint or 904 | twoas to its solution.” 905 |

906 | 907 | 908 | -------------------------------------------------------------------------------- /docs/The Red Headed League.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filename 6 | 7 | 8 | 9 |

The Red Headed League

10 |

11 | I had called upon my friend, Mr. Sherlock Holmes, one day in the autumnof 12 | last year, and found him in deep conversation with a very 13 | stout,florid-faced, elderly gentleman, with fiery red hair. With an 14 | apologyfor my intrusion, I was about to withdraw, when Holmes pulled 15 | meabruptly into the room and closed the door behind me. 16 |

17 |

18 | “You could not possibly have come at a better time, my dear Watson,” 19 | hesaid, cordially. 20 |

21 |

“I was afraid that you were engaged.”

22 |

“So I am. Very much so.”

23 |

“Then I can wait in the next room.”

24 |

25 | “Not at all. This gentleman, Mr. Wilson, has been my partner and helperin 26 | many of my most successful cases, and I have no doubt that he willbe of 27 | the utmost use to me in yours also.” 28 |

29 |

30 | The stout gentleman half-rose from his chair and gave a bob ofgreeting, 31 | with a quick, little, questioning glance from his small,fat-encircled 32 | eyes. 33 |

34 |

35 | “Try the settee,” said Holmes, relapsing into his arm-chair and puttinghis 36 | finger-tips together, as was his custom when in judicial moods. “Iknow, my 37 | dear Watson, that you share my love of all that is bizarre andoutside the 38 | conventions and humdrum routine of every-day life. You haveshown your 39 | relish for it by the enthusiasm which has prompted you tochronicle, and, 40 | if you will excuse my saying so, somewhat to embellishso many of my own 41 | little adventures.” 42 |

43 |

44 | “Your cases have indeed been of the greatest interest to me,” Iobserved. 45 |

46 |

47 | “You will remember that I remarked the other day, just before we wentinto 48 | the very simple problem presented by Miss Mary Sutherland, thatfor strange 49 | effects and extraordinary combinations we must go tolife itself, which is 50 | always far more daring than any effort of theimagination.” 51 |

52 |

“A proposition which I took the liberty of doubting.”

53 |

54 | “You did, doctor, but none the less you must come round to my view,for 55 | otherwise I shall keep on piling fact upon fact on you, until yourreason 56 | breaks down under them and acknowledges me to be right. Now, Mr.Jabez 57 | Wilson here has been good enough to call upon me this morning,and to begin 58 | a narrative which promises to be one of the most singularwhich I have 59 | listened to for some time. You have heard me remark thatthe strangest and 60 | most unique things are very often connected not withthe larger but with 61 | the smaller crimes, and occasionally, indeed, wherethere is room for doubt 62 | whether any positive crime has been committed.As far as I have heard it is 63 | impossible for me to say whether thepresent case is an instance of crime 64 | or not, but the course of eventsis certainly among the most singular that 65 | I have ever listened to.Perhaps, Mr. Wilson, you would have the great 66 | kindness to recommenceyour narrative. I ask you, not merely because my 67 | friend Dr. Watson hasnot heard the opening part, but also because the 68 | peculiar nature of thestory makes me anxious to have every possible detail 69 | from your lips.As a rule, when I have heard some slight indication of the 70 | course ofevents, I am able to guide myself by the thousands of other 71 | similarcases which occur to my memory. In the present instance I am forced 72 | toadmit that the facts are, to the best of my belief, unique.” 73 |

74 |

75 | The portly client puffed out his chest with an appearance of somelittle 76 | pride, and pulled a dirty and wrinkled newspaper from the insidepocket of 77 | his great-coat. As he glanced down the advertisement column,with his head 78 | thrust forward, and the paper flattened out upon hisknee, I took a good 79 | look at the man, and endeavored, after the fashionof my companion, to read 80 | the indications which might be presented byhis dress or appearance. 81 |

82 |

83 | I did not gain very much, however, by my inspection. Our visitor boreevery 84 | mark of being an average commonplace British tradesman, obese,pompous, and 85 | slow. He wore rather baggy gray shepherd’s check trousers,a not over-clean 86 | black frock-coat, unbuttoned in the front, and a drabwaistcoat with a 87 | heavy brassy Albert chain, and a square pierced bit ofmetal dangling down 88 | as an ornament. A frayed top-hat and a faded brownovercoat with a wrinkled 89 | velvet collar lay upon a chair beside him.Altogether, look as I would, 90 | there was nothing remarkable about the mansave his blazing red head, and 91 | the expression of extreme chagrin anddiscontent upon his features. 92 |

93 |

94 | Sherlock Holmes’s quick eye took in my occupation, and he shook hishead 95 | with a smile as he noticed my questioning glances. “Beyond theobvious 96 | facts that he has at some time done manual labor, that he takessnuff, that 97 | he is a Freemason, that he has been in China, and that hehas done a 98 | considerable amount of writing lately, I can deduce nothingelse.” 99 |

100 |

101 | Mr. Jabez Wilson started up in his chair, with his forefinger upon 102 | thepaper, but his eyes upon my companion. 103 |

104 |

105 | “How, in the name of good-fortune, did you know all that, Mr. Holmes?”he 106 | asked. “How did you know, for example, that I did manual labor. It’sas 107 | true as gospel, for I began as a ship’s carpenter.” 108 |

109 |

110 | “Your hands, my dear sir. Your right hand is quite a size larger thanyour 111 | left. You have worked with it, and the muscles are more developed.” 112 |

113 |

“Well, the snuff, then, and the Freemasonry?”

114 |

115 | “I won’t insult your intelligence by telling you how I read 116 | that,especially as, rather against the strict rules of your order, you 117 | usean arc-and-compass breastpin.” 118 |

119 |

“Ah, of course, I forgot that. But the writing?”

120 |

121 | “What else can be indicated by that right cuff so very shiny for 122 | fiveinches, and the left one with the smooth patch near the elbow where 123 | yourest it upon the desk.” 124 |

125 |

“Well, but China?”

126 |

127 | “The fish that you have tattooed immediately above your right wristcould 128 | only have been done in China. I have made a small study of tattoomarks, 129 | and have even contributed to the literature of the subject.That trick of 130 | staining the fishes’ scales of a delicate pink is quitepeculiar to China. 131 | When, in addition, I see a Chinese coin hanging fromyour watch-chain, the 132 | matter becomes even more simple.” 133 |

134 |

135 | Mr. Jabez Wilson laughed heavily. “Well, I never!” said he. “I thoughtat 136 | first that you had done something clever, but I see that there wasnothing 137 | in it, after all.” 138 |

139 |

140 | “I begin to think, Watson,” said Holmes, “that I make a mistake 141 | inexplaining. ‘Omne ignotum pro magnifico,’ you know, and my poor 142 | littlereputation, such as it is, will suffer shipwreck if I am so candid. 143 | Canyou not find the advertisement, Mr. Wilson?” 144 |

145 |

146 | “Yes, I have got it now,” he answered, with his thick, red fingerplanted 147 | half-way down the column. “Here it is. This is what began itall. You just 148 | read it for yourself, sir.” 149 |

150 |

I took the paper from him, and read as follows:

151 |

152 | “TO THE RED-HEADED LEAGUE: On account of the bequest of the late Ezekiah 153 | Hopkins, of Lebanon, Pa., U.S.A., there is now another vacancy open which 154 | entitles a member of the League to a salary of £4 a week for purely 155 | nominal services. All red-headed men who are sound in body and mind, and 156 | above the age of twenty-one years, are eligible. Apply in person on 157 | Monday, at eleven o’clock, to Duncan Ross, at the offices of the League, 7 158 | Pope’s Court, Fleet Street.” 159 |

160 |

161 | “What on earth does this mean?” I ejaculated, after I had twice readover 162 | the extraordinary announcement. 163 |

164 |

165 | Holmes chuckled, and wriggled in his chair, as was his habit when inhigh 166 | spirits. “It is a little off the beaten track, isn’t it?” saidhe. “And 167 | now, Mr. Wilson, off you go at scratch, and tell us all aboutyourself, 168 | your household, and the effect which this advertisement hadupon your 169 | fortunes. You will first make a note, doctor, of the paperand the date.” 170 |

171 |

172 | “It is _The Morning Chronicle_, of April 27, 1890. Just two months ago.” 173 |

174 |

“Very good. Now, Mr. Wilson?”

175 |

176 | “Well, it is just as I have been telling you, Mr. Sherlock Holmes,”said 177 | Jabez Wilson, mopping his forehead; “I have a small pawnbroker’sbusiness 178 | at Coburg Square, near the city. It’s not a very large affair,and of late 179 | years it has not done more than just give me a living. Iused to be able to 180 | keep two assistants, but now I only keep one; and Iwould have a job to pay 181 | him, but that he is willing to come for halfwages, so as to learn the 182 | business.” 183 |

184 |

“What is the name of this obliging youth?” asked Sherlock Holmes.

185 |

186 | “His name is Vincent Spaulding, and he’s not such a youth, either. 187 | It’shard to say his age. I should not wish a smarter assistant, Mr. 188 | Holmes;and I know very well that he could better himself, and earn twice 189 | whatI am able to give him. But, after all, if he is satisfied, why should 190 | Iput ideas in his head?” 191 |

192 |

193 | “Why, indeed? You seem most fortunate in having an _employé_ whocomes 194 | under the full market price. It is not a common experience amongemployers 195 | in this age. I don’t know that your assistant is not asremarkable as your 196 | advertisement.” 197 |

198 |

199 | “Oh, he has his faults, too,” said Mr. Wilson. “Never was such a fellowfor 200 | photography. Snapping away with a camera when he ought to beimproving his 201 | mind, and then diving down into the cellar like a rabbitinto its hole to 202 | develope his pictures. That is his main fault; but, onthe whole, he’s a 203 | good worker. There’s no vice in him.” 204 |

205 |

“He is still with you, I presume?”

206 |

207 | “Yes, sir. He and a girl of fourteen, who does a bit of simple cooking,and 208 | keeps the place clean—that’s all I have in the house, for I am awidower, 209 | and never had any family. We live very quietly, sir, the threeof us; and 210 | we keep a roof over our heads, and pay our debts, if we donothing more. 211 |

212 |

213 | “The first thing that put us out was that advertisement. Spaulding, hecame 214 | down into the office just this day eight weeks, with this verypaper in his 215 | hand, and he says: 216 |

217 |

“‘I wish to the Lord, Mr. Wilson, that I was a red-headed man.’

218 |

“‘Why that?’ I asks.

219 |

220 | “‘Why,’ says he, ‘here’s another vacancy on the League of theRed-headed 221 | Men. It’s worth quite a little fortune to any man who getsit, and I 222 | understand that there are more vacancies than there are men,so that the 223 | trustees are at their wits’ end what to do with the money.If my hair would 224 | only change color, here’s a nice little crib all readyfor me to step 225 | into.’ 226 |

227 |

228 | “‘Why, what is it, then?’ I asked. You see, Mr. Holmes, I am a 229 | verystay-at-home man, and as my business came to me instead of my havingto 230 | go to it, I was often weeks on end without putting my foot over 231 | thedoor-mat. In that way I didn’t know much of what was going on 232 | outside,and I was always glad of a bit of news. 233 |

234 |

235 | “‘Have you never heard of the League of the Red-headed Men?’ he asked,with 236 | his eyes open. 237 |

238 |

“‘Never.’

239 |

240 | “‘Why, I wonder at that, for you are eligible yourself for one of 241 | thevacancies.’ 242 |

243 |

“‘And what are they worth?’ I asked.

244 |

245 | “‘Oh, merely a couple of hundred a year, but the work is slight, and 246 | itneed not interfere very much with one’s other occupations.’ 247 |

248 |

249 | “Well, you can easily think that that made me prick up my ears, for 250 | thebusiness has not been over-good for some years, and an extra couple 251 | ofhundred would have been very handy. 252 |

253 |

“‘Tell me all about it,’ said I.

254 |

255 | “‘Well,’ said he, showing me the advertisement, ‘you can see foryourself 256 | that the League has a vacancy, and there is the addresswhere you should 257 | apply for particulars. As far as I can make out, theLeague was founded by 258 | an American millionaire, Ezekiah Hopkins, whowas very peculiar in his 259 | ways. He was himself red-headed, and he had agreat sympathy for all 260 | red-headed men; so, when he died, it was foundthat he had left his 261 | enormous fortune in the hands of trustees, withinstructions to apply the 262 | interest to the providing of easy berths tomen whose hair is of that 263 | color. From all I hear it is splendid pay,and very little to do.’ 264 |

265 |

266 | “‘But,’ said I, ‘there would be millions of red-headed men who 267 | wouldapply.’ 268 |

269 |

270 | “‘Not so many as you might think,’ he answered. ‘You see it is 271 | reallyconfined to Londoners, and to grown men. This American had started 272 | fromLondon when he was young, and he wanted to do the old town a good 273 | turn.Then, again, I have heard it is no use your applying if your hair 274 | islight red, or dark red, or anything but real bright, blazing, fieryred. 275 | Now, if you cared to apply, Mr. Wilson, you would just walk in;but perhaps 276 | it would hardly be worth your while to put yourself out ofthe way for the 277 | sake of a few hundred pounds.’ 278 |

279 |

280 | “Now, it is a fact, gentlemen, as you may see for yourselves, that myhair 281 | is of a very full and rich tint, so that it seemed to me that, ifthere was 282 | to be any competition in the matter, I stood as good a chanceas any man 283 | that I had ever met. Vincent Spaulding seemed to know somuch about it that 284 | I thought he might prove useful, so I just orderedhim to put up the 285 | shutters for the day, and to come right away with me.He was very willing 286 | to have a holiday, so we shut the business up, andstarted off for the 287 | address that was given us in the advertisement. 288 |

289 |

290 | “I never hope to see such a sight as that again, Mr. Holmes. Fromnorth, 291 | south, east, and west every man who had a shade of red in hishair had 292 | tramped into the city to answer the advertisement. FleetStreet was choked 293 | with red-headed folk, and Pope’s Court lookedlike a coster’s orange 294 | barrow. I should not have thought there wereso many in the whole country 295 | as were brought together by that singleadvertisement. Every shade of color 296 | they were—straw, lemon, orange,brick, Irish-setter, liver, clay; but, as 297 | Spaulding said, there werenot many who had the real vivid flame-colored 298 | tint. When I saw how manywere waiting, I would have given it up in 299 | despair; but Spaulding wouldnot hear of it. How he did it I could not 300 | imagine, but he pushed andpulled and butted until he got me through the 301 | crowd, and right up tothe steps which led to the office. There was a 302 | double stream upon thestair, some going up in hope, and some coming back 303 | dejected; but wewedged in as well as we could, and soon found ourselves in 304 | the office.” 305 |

306 |

307 | “Your experience has been a most entertaining one,” remarked Holmes, ashis 308 | client paused and refreshed his memory with a huge pinch of snuff.“Pray 309 | continue your very interesting statement.” 310 |

311 |

312 | “There was nothing in the office but a couple of wooden chairs and adeal 313 | table, behind which sat a small man, with a head that was evenredder than 314 | mine. He said a few words to each candidate as he cameup, and then he 315 | always managed to find some fault in them which woulddisqualify them. 316 | Getting a vacancy did not seem to be such a very easymatter, after all. 317 | However, when our turn came, the little man was muchmore favorable to me 318 | than to any of the others, and he closed the dooras we entered, so that he 319 | might have a private word with us. 320 |

321 |

322 | “‘This is Mr. Jabez Wilson,’ said my assistant, ‘and he is willing tofill 323 | a vacancy in the League.’ 324 |

325 |

326 | “‘And he is admirably suited for it,’ the other answered. ‘He has 327 | everyrequirement. I cannot recall when I have seen anything so fine.’ 328 | Hetook a step backward, cocked his head on one side, and gazed at my 329 | hairuntil I felt quite bashful. Then suddenly he plunged forward, wrung 330 | myhand, and congratulated me warmly on my success. 331 |

332 |

333 | “‘It would be injustice to hesitate,’ said he. ‘You will, however, I 334 | amsure, excuse me for taking an obvious precaution.’ With that he seizedmy 335 | hair in both his hands, and tugged until I yelled with the pain.‘There is 336 | water in your eyes,’ said he, as he released me. ‘I perceivethat all is as 337 | it should be. But we have to be careful, for we havetwice been deceived by 338 | wigs and once by paint. I could tell you talesof cobbler’s wax which would 339 | disgust you with human nature.’ He steppedover to the window, and shouted 340 | through it at the top of his voice thatthe vacancy was filled. A groan of 341 | disappointment came up from below,and the folk all trooped away in 342 | different directions, until there wasnot a red head to be seen except my 343 | own and that of the manager. 344 |

345 |

346 | “‘My name,’ said he, ‘is Mr. Duncan Ross, and I am myself one of 347 | thepensioners upon the fund left by our noble benefactor. Are you amarried 348 | man, Mr. Wilson? Have you a family?’ 349 |

350 |

“I answered that I had not.

351 |

“His face fell immediately.

352 |

353 | “‘Dear me!’ he said, gravely, ‘that is very serious indeed! I am sorryto 354 | hear you say that. The fund was, of course, for the propagationand spread 355 | of the red-heads as well as for their maintenance. It isexceedingly 356 | unfortunate that you should be a bachelor.’ 357 |

358 |

359 | “My face lengthened at this, Mr. Holmes, for I thought that I was notto 360 | have the vacancy after all; but, after thinking it over for a fewminutes, 361 | he said that it would be all right. 362 |

363 |

364 | “‘In the case of another,’ said he, ‘the objection might be fatal, butwe 365 | must stretch a point in favor of a man with such a head of hair asyours. 366 | When shall you be able to enter upon your new duties?’ 367 |

368 |

369 | “‘Well, it is a little awkward, for I have a business already,’ said I. 370 |

371 |

372 | “‘Oh, never mind about that, Mr. Wilson!’ said Vincent Spaulding. ‘Ishall 373 | be able to look after that for you.’ 374 |

375 |

“‘What would be the hours?’ I asked.

376 |

“‘Ten to two.’

377 |

378 | “Now a pawnbroker’s business is mostly done of an evening, Mr. 379 | Holmes,especially Thursday and Friday evening, which is just before 380 | pay-day;so it would suit me very well to earn a little in the 381 | mornings.Besides, I knew that my assistant was a good man, and that he 382 | would seeto anything that turned up. 383 |

384 |

“‘That would suit me very well,’ said I. ‘And the pay?’

385 |

“‘Is £4 a week.’

386 |

“‘And the work?’

387 |

“‘Is purely nominal.’

388 |

“‘What do you call purely nominal?’

389 |

390 | “‘Well, you have to be in the office, or at least in the building, 391 | thewhole time. If you leave, you forfeit your whole position forever.The 392 | will is very clear upon that point. You don’t comply with theconditions if 393 | you budge from the office during that time.’ 394 |

395 |

396 | “‘It’s only four hours a day, and I should not think of leaving,’ saidI. 397 |

398 |

399 | “‘No excuse will avail,’ said Mr. Duncan Ross, ‘neither sickness 400 | norbusiness nor anything else. There you must stay, or you lose 401 | yourbillet.’ 402 |

403 |

“‘And the work?’

404 |

405 | “‘Is to copy out the “Encyclopædia Britannica.” There is the firstvolume 406 | of it in that press. You must find your own ink, pens, andblotting-paper, 407 | but we provide this table and chair. Will you be readyto-morrow?’ 408 |

409 |

“‘Certainly,’ I answered.

410 |

411 | “‘Then, good-bye, Mr. Jabez Wilson, and let me congratulate you oncemore 412 | on the important position which you have been fortunate enough togain.’ He 413 | bowed me out of the room, and I went home with my assistant,hardly knowing 414 | what to say or do, I was so pleased at my own goodfortune. 415 |

416 |

417 | “Well, I thought over the matter all day, and by evening I was inlow 418 | spirits again; for I had quite persuaded myself that the wholeaffair must 419 | be some great hoax or fraud, though what its object mightbe I could not 420 | imagine. It seemed altogether past belief that any onecould make such a 421 | will, or that they would pay such a sum for doinganything so simple as 422 | copying out the ‘Encyclopædia Britannica.’Vincent Spaulding did what he 423 | could to cheer me up, but by bedtime Ihad reasoned myself out of the whole 424 | thing. However, in the morningI determined to have a look at it anyhow, so 425 | I bought a penny bottleof ink, and with a quill-pen, and seven sheets of 426 | foolscap paper, Istarted off for Pope’s Court. 427 |

428 |

429 | “Well, to my surprise and delight, everything was as right as possible.The 430 | table was set out ready for me, and Mr. Duncan Ross was there tosee that I 431 | got fairly to work. He started me off upon the letter A, andthen he left 432 | me; but he would drop in from time to time to see that allwas right with 433 | me. At two o’clock he bade me good-day, complimented meupon the amount 434 | that I had written, and locked the door of the officeafter me. 435 |

436 |

437 | “This went on day after day, Mr. Holmes, and on Saturday the managercame 438 | in and planked down four golden sovereigns for my week’s work.It was the 439 | same next week, and the same the week after. Every morningI was there at 440 | ten, and every afternoon I left at two. By degrees Mr.Duncan Ross took to 441 | coming in only once of a morning, and then, aftera time, he did not come 442 | in at all. Still, of course, I never dared toleave the room for an 443 | instant, for I was not sure when he might come,and the billet was such a 444 | good one, and suited me so well, that I wouldnot risk the loss of it. 445 |

446 |

447 | “Eight weeks passed away like this, and I had written about Abbots 448 | andArchery and Armor and Architecture and Attica, and hoped with 449 | diligencethat I might get on to the B’s before very long. It cost me 450 | somethingin foolscap, and I had pretty nearly filled a shelf with my 451 | writings.And then suddenly the whole business came to an end.” 452 |

453 |

“To an end?”

454 |

455 | “Yes, sir. And no later than this morning. I went to my work as usualat 456 | ten o’clock, but the door was shut and locked, with a little squareof 457 | card-board hammered on to the middle of the panel with a tack. Hereit is, 458 | and you can read for yourself.” 459 |

460 |

461 | He held up a piece of white card-board about the size of a sheet 462 | ofnote-paper. It read in this fashion: 463 |

464 |

“THE RED-HEADED LEAGUE IS DISSOLVED. _October 9, 1890._”

465 |

466 | Sherlock Holmes and I surveyed this curt announcement and the ruefulface 467 | behind it, until the comical side of the affair so completelyovertopped 468 | every other consideration that we both burst out into a roarof laughter. 469 |

470 |

471 | “I cannot see that there is anything very funny,” cried our 472 | client,flushing up to the roots of his flaming head. “If you can do 473 | nothingbetter than laugh at me, I can go elsewhere.” 474 |

475 |

476 | “No, no,” cried Holmes, shoving him back into the chair from which hehad 477 | half risen. “I really wouldn’t miss your case for the world. It ismost 478 | refreshingly unusual. But there is, if you will excuse my sayingso, 479 | something just a little funny about it. Pray what steps did youtake when 480 | you found the card upon the door?” 481 |

482 |

483 | “I was staggered, sir. I did not know what to do. Then I called atthe 484 | offices round, but none of them seemed to know anything about it.Finally, 485 | I went to the landlord, who is an accountant living on theground-floor, 486 | and I asked him if he could tell me what had become ofthe Red-headed 487 | League. He said that he had never heard of any suchbody. Then I asked him 488 | who Mr. Duncan Ross was. He answered that thename was new to him. 489 |

490 |

[Illustration: “THE DOOR WAS SHUT AND LOCKED”]

491 |

“‘Well,’ said I, ‘the gentleman at No. 4.’

492 |

“‘What, the red-headed man?’

493 |

“‘Yes.’

494 |

495 | “‘Oh,’ said he, ‘his name was William Morris. He was a solicitor, andwas 496 | using my room as a temporary convenience until his new premiseswere ready. 497 | He moved out yesterday.’ 498 |

499 |

“‘Where could I find him?’

500 |

501 | “‘Oh, at his new offices. He did tell me the address. Yes, 17 KingEdward 502 | Street, near St. Paul’s.’ 503 |

504 |

505 | “I started off, Mr. Holmes, but when I got to that address it was 506 | amanufactory of artificial knee-caps, and no one in it had ever heard 507 | ofeither Mr. William Morris or Mr. Duncan Ross.” 508 |

509 |

“And what did you do then?” asked Holmes.

510 |

511 | “I went home to Saxe-Coburg Square, and I took the advice of myassistant. 512 | But he could not help me in any way. He could only say thatif I waited I 513 | should hear by post. But that was not quite good enough,Mr. Holmes. I did 514 | not wish to lose such a place without a struggle, so,as I had heard that 515 | you were good enough to give advice to poor folkwho were in need of it, I 516 | came right away to you.” 517 |

518 |

519 | “And you did very wisely,” said Holmes. “Your case is an 520 | exceedinglyremarkable one, and I shall be happy to look into it. From what 521 | youhave told me I think that it is possible that graver issues hang fromit 522 | than might at first sight appear.” 523 |

524 |

525 | “Grave enough!” said Mr. Jabez Wilson. “Why, I have lost four pound 526 | aweek.” 527 |

528 |

529 | “As far as you are personally concerned,” remarked Holmes, “I do notsee 530 | that you have any grievance against this extraordinary league. Onthe 531 | contrary, you are, as I understand, richer by some £30, to saynothing of 532 | the minute knowledge which you have gained on every subjectwhich comes 533 | under the letter A. You have lost nothing by them.” 534 |

535 |

536 | “No, sir. But I want to find out about them, and who they are, and 537 | whattheir object was in playing this prank—if it was a prank—upon me. 538 | Itwas a pretty expensive joke for them, for it cost them two and 539 | thirtypounds.” 540 |

541 |

542 | “We shall endeavor to clear up these points for you. And, first, oneor two 543 | questions, Mr. Wilson. This assistant of yours who first calledyour 544 | attention to the advertisement—how long had he been with you?” 545 |

546 |

“About a month then.”

547 |

“How did he come?”

548 |

“In answer to an advertisement.”

549 |

“Was he the only applicant?”

550 |

“No, I had a dozen.”

551 |

“Why did you pick him?”

552 |

“Because he was handy, and would come cheap.”

553 |

“At half-wages, in fact.”

554 |

“Yes.”

555 |

“What is he like, this Vincent Spaulding?”

556 |

557 | “Small, stout-built, very quick in his ways, no hair on his face,though 558 | he’s not short of thirty. Has a white splash of acid upon hisforehead.” 559 |

560 |

561 | Holmes sat up in his chair in considerable excitement. “I thought asmuch,” 562 | said he. “Have you ever observed that his ears are pierced forearrings?” 563 |

564 |

565 | “Yes, sir. He told me that a gypsy had done it for him when he was alad.” 566 |

567 |

568 | “Hum!” said Holmes, sinking back in deep thought. “He is still withyou?” 569 |

570 |

“Oh yes, sir; I have only just left him.”

571 |

“And has your business been attended to in your absence?”

572 |

573 | “Nothing to complain of, sir. There’s never very much to do of amorning.” 574 |

575 |

576 | “That will do, Mr. Wilson. I shall be happy to give you an opinion uponthe 577 | subject in the course of a day or two. To-day is Saturday, and Ihope that 578 | by Monday we may come to a conclusion.” 579 |

580 |

581 | “Well, Watson,” said Holmes, when our visitor had left us, “what do 582 | youmake of it all?” 583 |

584 |

585 | “I make nothing of it,” I answered, frankly. “It is a most 586 | mysteriousbusiness.” 587 |

588 |

589 | “As a rule,” said Holmes, “the more bizarre a thing is the lessmysterious 590 | it proves to be. It is your commonplace, featureless crimeswhich are 591 | really puzzling, just as a commonplace face is the mostdifficult to 592 | identify. But I must be prompt over this matter.” 593 |

594 |

“What are you going to do, then?” I asked.

595 |

596 | “To smoke,” he answered. “It is quite a three-pipe problem, and I begthat 597 | you won’t speak to me for fifty minutes.” He curled himself upin his 598 | chair, with his thin knees drawn up to his hawk-like nose, andthere he sat 599 | with his eyes closed and his black clay pipe thrusting outlike the bill of 600 | some strange bird. I had come to the conclusion thathe had dropped asleep, 601 | and indeed was nodding myself, when he suddenlysprang out of his chair 602 | with the gesture of a man who has made up hismind, and put his pipe down 603 | upon the mantel-piece. 604 |

605 |

606 | “Sarasate plays at the St. James’s Hall this afternoon,” he remarked.“What 607 | do you think, Watson? Could your patients spare you for a fewhours?” 608 |

609 |

“I have nothing to do to-day. My practice is never very absorbing.”

610 |

611 | “Then put on your hat and come. I am going through the city first, andwe 612 | can have some lunch on the way. I observe that there is a good dealof 613 | German music on the programme, which is rather more to my taste 614 | thanItalian or French. It is introspective, and I want to introspect. 615 | Comealong!” 616 |

617 |

618 | We travelled by the Underground as far as Aldersgate; and a short walktook 619 | us to Saxe-Coburg Square, the scene of the singular story which wehad 620 | listened to in the morning. It was a pokey, little, shabby-genteelplace, 621 | where four lines of dingy two-storied brick houses looked outinto a small 622 | railed-in enclosure, where a lawn of weedy grass anda few clumps of faded 623 | laurel-bushes made a hard fight against asmoke-laden and uncongenial 624 | atmosphere. Three gilt balls and a brownboard with “JABEZ WILSON” in white 625 | letters, upon a cornerhouse, announced the place where our red-headed 626 | client carried on hisbusiness. Sherlock Holmes stopped in front of it with 627 | his head on oneside, and looked it all over, with his eyes shining 628 | brightly betweenpuckered lids. Then he walked slowly up the street, and 629 | then down againto the corner, still looking keenly at the houses. Finally 630 | he returnedto the pawnbroker’s, and, having thumped vigorously upon the 631 | pavementwith his stick two or three times, he went up to the door and 632 | knocked.It was instantly opened by a bright-looking, clean-shaven young 633 | fellow,who asked him to step in. 634 |

635 |

636 | “Thank you,” said Holmes, “I only wished to ask you how you would gofrom 637 | here to the Strand.” 638 |

639 |

640 | “Third right, fourth left,” answered the assistant, promptly, closingthe 641 | door. 642 |

643 |

644 | “Smart fellow, that,” observed Holmes, as we walked away. “He is, in 645 | myjudgment, the fourth smartest man in London, and for daring I am notsure 646 | that he has not a claim to be third. I have known something of himbefore.” 647 |

648 |

649 | “Evidently,” said I, “Mr. Wilson’s assistant counts for a good deal inthis 650 | mystery of the Red-headed League. I am sure that you inquired yourway 651 | merely in order that you might see him.” 652 |

653 |

“Not him.”

654 |

“What then?”

655 |

“The knees of his trousers.”

656 |

“And what did you see?”

657 |

“What I expected to see.”

658 |

“Why did you beat the pavement?”

659 |

660 | “My dear doctor, this is a time for observation, not for talk. We arespies 661 | in an enemy’s country. We know something of Saxe-Coburg Square.Let us now 662 | explore the parts which lie behind it.” 663 |

664 |

665 | The road in which we found ourselves as we turned round the cornerfrom the 666 | retired Saxe-Coburg Square presented as great a contrast toit as the front 667 | of a picture does to the back. It was one of the mainarteries which convey 668 | the traffic of the city to the north and west.The roadway was blocked with 669 | the immense stream of commerce flowingin a double tide inward and outward, 670 | while the foot-paths were blackwith the hurrying swarm of pedestrians. It 671 | was difficult to realizeas we looked at the line of fine shops and stately 672 | business premisesthat they really abutted on the other side upon the faded 673 | and stagnantsquare which we had just quitted. 674 |

675 |

676 | “Let me see,” said Holmes, standing at the corner, and glancing alongthe 677 | line, “I should like just to remember the order of the houses here.It is a 678 | hobby of mine to have an exact knowledge of London. There isMortimer’s, 679 | the tobacconist, the little newspaper shop, the Coburgbranch of the City 680 | and Suburban Bank, the Vegetarian Restaurant, andMcFarlane’s 681 | carriage-building depot. That carries us right on to theother block. And 682 | now, doctor, we’ve done our work, so it’s time we hadsome play. A sandwich 683 | and a cup of coffee, and then off to violin-land,where all is sweetness 684 | and delicacy and harmony, and there are nored-headed clients to vex us 685 | with their conundrums.” 686 |

687 |

688 | My friend was an enthusiastic musician, being himself not only avery 689 | capable performer, but a composer of no ordinary merit. All theafternoon 690 | he sat in the stalls wrapped in the most perfect happiness,gently waving 691 | his long, thin fingers in time to the music, while hisgently smiling face 692 | and his languid, dreamy eyes were as unlike thoseof Holmes, the 693 | sleuth-hound, Holmes the relentless, keen-witted,ready-handed criminal 694 | agent, as it was possible to conceive. In hissingular character the dual 695 | nature alternately asserted itself, andhis extreme exactness and 696 | astuteness represented, as I have oftenthought, the reaction against the 697 | poetic and contemplative mood whichoccasionally predominated in him. The 698 | swing of his nature took him fromextreme languor to devouring energy; and, 699 | as I knew well, he was neverso truly formidable as when, for days on end, 700 | he had been lounging inhis arm-chair amid his improvisations and his 701 | black-letter editions.Then it was that the lust of the chase would 702 | suddenly come upon him,and that his brilliant reasoning power would rise 703 | to the level ofintuition, until those who were unacquainted with his 704 | methods wouldlook askance at him as on a man whose knowledge was not that 705 | of othermortals. When I saw him that afternoon so enrapt in the music at 706 | St.James’s Hall I felt that an evil time might be coming upon those whomhe 707 | had set himself to hunt down. 708 |

709 |

“You want to go home, no doubt, doctor,” he remarked, as we emerged.

710 |

“Yes, it would be as well.”

711 |

712 | “And I have some business to do which will take some hours. Thisbusiness 713 | at Coburg Square is serious.” 714 |

715 |

“Why serious?”

716 |

717 | “A considerable crime is in contemplation. I have every reason tobelieve 718 | that we shall be in time to stop it. But to-day being Saturdayrather 719 | complicates matters. I shall want your help to-night.” 720 |

721 |

“At what time?”

722 |

“Ten will be early enough.”

723 |

“I shall be at Baker Street at ten.”

724 |

725 | “Very well. And, I say, doctor, there may be some little danger, sokindly 726 | put your army revolver in your pocket.” He waved his hand,turned on his 727 | heel, and disappeared in an instant among the crowd. 728 |

729 |

[Illustration: “ALL AFTERNOON HE SAT IN THE STALLS”]

730 |

731 | I trust that I am not more dense than my neighbors, but I was 732 | alwaysoppressed with a sense of my own stupidity in my dealings with 733 | SherlockHolmes. Here I had heard what he had heard, I had seen what he 734 | hadseen, and yet from his words it was evident that he saw clearly notonly 735 | what had happened, but what was about to happen, while to me thewhole 736 | business was still confused and grotesque. As I drove home tomy house in 737 | Kensington I thought over it all, from the extraordinarystory of the 738 | red-headed copier of the “Encyclopædia” down to the visitto Saxe-Coburg 739 | Square, and the ominous words with which he had partedfrom me. What was 740 | this nocturnal expedition, and why should I go armed?Where were we going, 741 | and what were we to do? I had the hint from Holmesthat this smooth-faced 742 | pawnbroker’s assistant was a formidable man—aman who might play a deep 743 | game. I tried to puzzle it out, but gave itup in despair, and set the 744 | matter aside until night should bring anexplanation. 745 |

746 |

747 | It was a quarter past nine when I started from home and made my wayacross 748 | the Park, and so through Oxford Street to Baker Street. Twohansoms were 749 | standing at the door, and, as I entered the passage, Iheard the sound of 750 | voices from above. On entering his room I foundHolmes in animated 751 | conversation with two men, one of whom I recognizedas Peter Jones, the 752 | official police agent, while the other was a long,thin, sad-faced man, 753 | with a very shiny hat and oppressively respectablefrock-coat. 754 |

755 |

756 | “Ha! our party is complete,” said Holmes, buttoning up his pea-jacket,and 757 | taking his heavy hunting crop from the rack. “Watson, I thinkyou know Mr. 758 | Jones, of Scotland Yard? Let me introduce you to Mr.Merryweather, who is 759 | to be our companion in to-night’s adventure.” 760 |

761 |

762 | “We’re hunting in couples again, doctor, you see,” said Jones, in 763 | hisconsequential way. “Our friend here is a wonderful man for starting 764 | achase. All he wants is an old dog to help him to do the running down.” 765 |

766 |

767 | “I hope a wild goose may not prove to be the end of our chase,”observed 768 | Mr. Merryweather, gloomily. 769 |

770 |

771 | “You may place considerable confidence in Mr. Holmes, sir,” said thepolice 772 | agent, loftily. “He has his own little methods, which are, if hewon’t mind 773 | my saying so, just a little too theoretical and fantastic,but he has the 774 | makings of a detective in him. It is not too much tosay that once or 775 | twice, as in that business of the Sholto murder andthe Agra treasure, he 776 | has been more nearly correct than the officialforce.” 777 |

778 |

779 | “Oh, if you say so, Mr. Jones, it is all right,” said the stranger,with 780 | deference. “Still, I confess that I miss my rubber. It is thefirst 781 | Saturday night for seven-and-twenty years that I have not had myrubber.” 782 |

783 |

784 | “I think you will find,” said Sherlock Holmes, “that you will play fora 785 | higher stake to-night than you have ever done yet, and that the playwill 786 | be more exciting. For you, Mr. Merryweather, the stake will besome 787 | £30,000; and for you, Jones, it will be the man upon whom you wishto lay 788 | your hands.” 789 |

790 |

791 | “John Clay, the murderer, thief, smasher, and forger. He’s a young man,Mr. 792 | Merryweather, but he is at the head of his profession, and I wouldrather 793 | have my bracelets on him than on any criminal in London. He’s aremarkable 794 | man, is young John Clay. His grandfather was a royal duke,and he himself 795 | has been to Eton and Oxford. His brain is as cunning ashis fingers, and 796 | though we meet signs of him at every turn, we neverknow where to find the 797 | man himself. He’ll crack a crib in Scotland oneweek, and be raising money 798 | to build an orphanage in Cornwall the next.I’ve been on his track for 799 | years, and have never set eyes on him yet.” 800 |

801 |

802 | “I hope that I may have the pleasure of introducing you to-night. I’vehad 803 | one or two little turns also with Mr. John Clay, and I agree withyou that 804 | he is at the head of his profession. It is past ten, however,and quite 805 | time that we started. If you two will take the first hansom,Watson and I 806 | will follow in the second.” 807 |

808 |

809 | Sherlock Holmes was not very communicative during the long drive,and lay 810 | back in the cab humming the tunes which he had heard in theafternoon. We 811 | rattled through an endless labyrinth of gas-lit streetsuntil we emerged 812 | into Farringdon Street. 813 |

814 |

815 | “We are close there now,” my friend remarked. “This fellow Merryweatheris 816 | a bank director, and personally interested in the matter. I thoughtit as 817 | well to have Jones with us also. He is not a bad fellow, thoughan absolute 818 | imbecile in his profession. He has one positive virtue. Heis as brave as a 819 | bull-dog, and as tenacious as a lobster if he gets hisclaws upon any one. 820 | Here we are, and they are waiting for us.” 821 |

822 |

823 | We had reached the same crowded thoroughfare in which we had 824 | foundourselves in the morning. Our cabs were dismissed, and, followingthe 825 | guidance of Mr. Merryweather, we passed down a narrow passageand through a 826 | side door, which he opened for us. Within there was asmall corridor, which 827 | ended in a very massive iron gate. This also wasopened, and led down a 828 | flight of winding stone steps, which terminatedat another formidable gate. 829 | Mr. Merryweather stopped to light alantern, and then conducted us down a 830 | dark, earth-smelling passage, andso, after opening a third door, into a 831 | huge vault or cellar, which waspiled all round with crates and massive 832 | boxes. 833 |

834 |

835 | “You are not very vulnerable from above,” Holmes remarked, as he heldup 836 | the lantern and gazed about him. 837 |

838 |

839 | “Nor from below,” said Mr. Merryweather, striking his stick upon theflags 840 | which lined the floor. “Why, dear me, it sounds quite hollow!” heremarked, 841 | looking up in surprise. 842 |

843 |

844 | “I must really ask you to be a little more quiet,” said Holmes,severely. 845 | “You have already imperilled the whole success of ourexpedition. Might I 846 | beg that you would have the goodness to sit downupon one of those boxes, 847 | and not to interfere?” 848 |

849 |

850 | The solemn Mr. Merryweather perched himself upon a crate, with a 851 | veryinjured expression upon his face, while Holmes fell upon his kneesupon 852 | the floor, and, with the lantern and a magnifying lens, began toexamine 853 | minutely the cracks between the stones. A few seconds sufficedto satisfy 854 | him, for he sprang to his feet again, and put his glass inhis pocket. 855 |

856 |

857 | “We have at least an hour before us,” he remarked; “for they canhardly 858 | take any steps until the good pawnbroker is safely in bed.Then they will 859 | not lose a minute, for the sooner they do their workthe longer time they 860 | will have for their escape. We are at present,doctor—as no doubt you have 861 | divined—in the cellar of the city branchof one of the principal London 862 | banks. Mr. Merryweather is the chairmanof directors, and he will explain 863 | to you that there are reasons why themore daring criminals of London 864 | should take a considerable interest inthis cellar at present.” 865 |

866 |

867 | “It is our French gold,” whispered the director. “We have had 868 | severalwarnings that an attempt might be made upon it.” 869 |

870 |

“Your French gold?”

871 |

872 | “Yes. We had occasion some months ago to strengthen our resources, 873 | andborrowed, for that purpose, 30,000 napoleons from the Bank of France.It 874 | has become known that we have never had occasion to unpack themoney, and 875 | that it is still lying in our cellar. The crate upon whichI sit contains 876 | 2000 napoleons packed between layers of lead foil. Ourreserve of bullion 877 | is much larger at present than is usually kept in asingle branch office, 878 | and the directors have had misgivings upon thesubject.” 879 |

880 |

881 | “Which were very well justified,” observed Holmes. “And now it is timethat 882 | we arranged our little plans. I expect that within an hour matterswill 883 | come to a head. In the mean time, Mr. Merryweather, we must putthe screen 884 | over that dark lantern.” 885 |

886 |

“And sit in the dark?”

887 |

888 | “I am afraid so. I had brought a pack of cards in my pocket, and Ithought 889 | that, as we were a _partie carrée_, you might have your rubberafter all. 890 | But I see that the enemy’s preparations have gone so farthat we cannot 891 | risk the presence of a light. And, first of all, we mustchoose our 892 | positions. These are daring men, and though we shall takethem at a 893 | disadvantage, they may do us some harm unless we are careful.I shall stand 894 | behind this crate, and do you conceal yourselves behindthose. Then, when I 895 | flash a light upon them, close in swiftly. If theyfire, Watson, have no 896 | compunction about shooting them down.” 897 |

898 |

899 | I placed my revolver, cocked, upon the top of the wooden case behindwhich 900 | I crouched. Holmes shot the slide across the front of hislantern, and left 901 | us in pitch darkness—such an absolute darknessas I have never before 902 | experienced. The smell of hot metal remainedto assure us that the light 903 | was still there, ready to flash out ata moment’s notice. To me, with my 904 | nerves worked up to a pitch ofexpectancy, there was something depressing 905 | and subduing in the suddengloom, and in the cold, dank air of the vault. 906 |

907 |

908 | “They have but one retreat,” whispered Holmes. “That is back throughthe 909 | house into Saxe-Coburg Square. I hope that you have done what Iasked you, 910 | Jones?” 911 |

912 |

“I have an inspector and two officers waiting at the front door.”

913 |

914 | “Then we have stopped all the holes. And now we must be silent andwait.” 915 |

916 |

917 | What a time it seemed! From comparing notes afterwards it was but anhour 918 | and a quarter, yet it appeared to me that the night must havealmost gone, 919 | and the dawn be breaking above us. My limbs were weary andstiff, for I 920 | feared to change my position; yet my nerves were workedup to the highest 921 | pitch of tension, and my hearing was so acute that Icould not only hear 922 | the gentle breathing of my companions, but I coulddistinguish the deeper, 923 | heavier in-breath of the bulky Jones from thethin, sighing note of the 924 | bank director. From my position I could lookover the case in the direction 925 | of the floor. Suddenly my eyes caughtthe glint of a light. 926 |

927 |

928 | At first it was but a lurid spark upon the stone pavement. Then 929 | itlengthened out until it became a yellow line, and then, without 930 | anywarning or sound, a gash seemed to open and a hand appeared; a 931 | white,almost womanly hand, which felt about in the centre of the little 932 | areaof light. For a minute or more the hand, with its writhing 933 | fingers,protruded out of the floor. Then it was withdrawn as suddenly as 934 | itappeared, and all was dark again save the single lurid spark whichmarked 935 | a chink between the stones. 936 |

937 |

938 | Its disappearance, however, was but momentary. With a rending, 939 | tearingsound, one of the broad, white stones turned over upon its side, 940 | andleft a square, gaping hole, through which streamed the light of 941 | alantern. Over the edge there peeped a clean-cut, boyish face, whichlooked 942 | keenly about it, and then, with a hand on either side of theaperture, drew 943 | itself shoulder-high and waist-high, until one kneerested upon the edge. 944 | In another instant he stood at the side of thehole, and was hauling after 945 | him a companion, lithe and small likehimself, with a pale face and a shock 946 | of very red hair. 947 |

948 |

949 | “It’s all clear,” he whispered. “Have you the chisel and the bags.Great 950 | Scott! Jump, Archie, jump, and I’ll swing for it!” 951 |

952 |

953 | Sherlock Holmes had sprung out and seized the intruder by the collar.The 954 | other dived down the hole, and I heard the sound of rending clothas Jones 955 | clutched at his skirts. The light flashed upon the barrel of arevolver, 956 | but Holmes’s hunting crop came down on the man’s wrist, andthe pistol 957 | clinked upon the stone floor. 958 |

959 |

960 | “It’s no use, John Clay,” said Holmes, blandly. “You have no chance 961 | atall.” 962 |

963 |

964 | “So I see,” the other answered, with the utmost coolness. “I fancy thatmy 965 | pal is all right, though I see you have got his coat-tails.” 966 |

967 |

“There are three men waiting for him at the door,” said Holmes.

968 |

969 | “Oh, indeed! You seem to have done the thing very completely. I 970 | mustcompliment you.” 971 |

972 |

973 | “And I you,” Holmes answered. “Your red-headed idea was very new 974 | andeffective.” 975 |

976 |

977 | “You’ll see your pal again presently,” said Jones. “He’s quicker 978 | atclimbing down holes than I am. Just hold out while I fix the derbies.” 979 |

980 |

981 | “I beg that you will not touch me with your filthy hands,” remarkedour 982 | prisoner, as the handcuffs clattered upon his wrists. “You may notbe aware 983 | that I have royal blood in my veins. Have the goodness, also,when you 984 | address me always to say ‘sir’ and ‘please.’” 985 |

986 |

987 | “All right,” said Jones, with a stare and a snigger. “Well, would 988 | youplease, sir, march up-stairs, where we can get a cab to carry 989 | yourhighness to the police-station?” 990 |

991 |

992 | “That is better,” said John Clay, serenely. He made a sweeping bow tothe 993 | three of us, and walked quietly off in the custody of the detective. 994 |

995 |

996 | “Really Mr. Holmes,” said Mr. Merryweather, as we followed them fromthe 997 | cellar, “I do not know how the bank can thank you or repay you.There is no 998 | doubt that you have detected and defeated in the mostcomplete manner one 999 | of the most determined attempts at bank robberythat have ever come within 1000 | my experience.” 1001 |

1002 |

1003 | “I have had one or two little scores of my own to settle with Mr.John 1004 | Clay,” said Holmes. “I have been at some small expense over thismatter, 1005 | which I shall expect the bank to refund, but beyond that I amamply repaid 1006 | by having had an experience which is in many ways unique,and by hearing 1007 | the very remarkable narrative of the Red-headed League.” 1008 |

1009 |

* * * * *

1010 |

1011 | “You see, Watson,” he explained, in the early hours of the morning,as we 1012 | sat over a glass of whiskey-and-soda in Baker Street, “it wasperfectly 1013 | obvious from the first that the only possible object of thisrather 1014 | fantastic business of the advertisement of the League, and thecopying of 1015 | the ‘Encyclopædia,’ must be to get this not over-brightpawnbroker out of 1016 | the way for a number of hours every day. It was acurious way of managing 1017 | it, but, really, it would be difficult tosuggest a better. The method was 1018 | no doubt suggested to Clay’s ingeniousmind by the color of his 1019 | accomplice’s hair. The £4 a week was a lurewhich must draw him, and what 1020 | was it to them, who were playing forthousands? They put in the 1021 | advertisement, one rogue has the temporaryoffice, the other rogue incites 1022 | the man to apply for it, and togetherthey manage to secure his absence 1023 | every morning in the week. Fromthe time that I heard of the assistant 1024 | having come for half wages,it was obvious to me that he had some strong 1025 | motive for securing thesituation.” 1026 |

1027 |

“But how could you guess what the motive was?”

1028 |

1029 | “Had there been women in the house, I should have suspected a merevulgar 1030 | intrigue. That, however, was out of the question. The man’sbusiness was a 1031 | small one, and there was nothing in his house whichcould account for such 1032 | elaborate preparations, and such an expenditureas they were at. It must, 1033 | then, be something out of the house. Whatcould it be? I thought of the 1034 | assistant’s fondness for photography,and his trick of vanishing into the 1035 | cellar. The cellar! There was theend of this tangled clue. Then I made 1036 | inquiries as to this mysteriousassistant, and found that I had to deal 1037 | with one of the coolestand most daring criminals in London. He was doing 1038 | something in thecellar—something which took many hours a day for months on 1039 | end. Whatcould it be, once more? I could think of nothing save that he 1040 | wasrunning a tunnel to some other building. 1041 |

1042 |

1043 | “So far I had got when we went to visit the scene of action. Isurprised 1044 | you by beating upon the pavement with my stick. I wasascertaining whether 1045 | the cellar stretched out in front or behind.It was not in front. Then I 1046 | rang the bell, and, as I hoped, theassistant answered it. We have had some 1047 | skirmishes, but we had neverset eyes upon each other before. I hardly 1048 | looked at his face. Hisknees were what I wished to see. You must yourself 1049 | have remarked howworn, wrinkled, and stained they were. They spoke of 1050 | those hours ofburrowing. The only remaining point was what they were 1051 | burrowing for. Iwalked round the corner, saw that the City and Suburban 1052 | Bank abutted onour friend’s premises, and felt that I had solved my 1053 | problem. When youdrove home after the concert I called upon Scotland Yard, 1054 | and upon thechairman of the bank directors, with the result that you have 1055 | seen.” 1056 |

1057 |

1058 | “And how could you tell that they would make their attempt to-night?” 1059 | Iasked. 1060 |

1061 |

1062 | “Well, when they closed their League offices that was a sign that 1063 | theycared no longer about Mr. Jabez Wilson’s presence—in other words,that 1064 | they had completed their tunnel. But it was essential that theyshould use 1065 | it soon, as it might be discovered, or the bullion mightbe removed. 1066 | Saturday would suit them better than any other day, as itwould give them 1067 | two days for their escape. For all these reasons Iexpected them to come 1068 | to-night.” 1069 |

1070 |

1071 | “You reasoned it out beautifully,” I exclaimed, in unfeignedadmiration. 1072 | “It is so long a chain, and yet every link rings true.” 1073 |

1074 |

1075 | “It saved me from ennui,” he answered, yawning. “Alas! I already feelit 1076 | closing in upon me. My life is spent in one long effort to escapefrom the 1077 | commonplaces of existence. These little problems help me to doso.” 1078 |

1079 |

“And you are a benefactor of the race,” said I.

1080 |

1081 | He shrugged his shoulders. “Well, perhaps, after all, it is of somelittle 1082 | use,” he remarked. “‘L’homme c’est rien—l’oeuvre c’esttout,’ as Gustave 1083 | Flaubert wrote to Georges Sand.” 1084 |

1085 | 1086 | 1087 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "octo-ssg", 3 | "version": "0.1.0", 4 | "description": "A tool that allows you to generate static sites based off of text data.", 5 | "main": "bin/app.js", 6 | "bin": { 7 | "octo": "./bin/app.js" 8 | }, 9 | "scripts": { 10 | "prepare": "husky install", 11 | "start": "node ./bin/app.js", 12 | "build": "npm run prettier && npm run eslint-fix && npm run eslint", 13 | "test": "jest", 14 | "coverage": "jest --coverage", 15 | "eslint": "npx eslint .", 16 | "eslint-fix": "eslint --fix .", 17 | "prettier": "prettier --write .", 18 | "prettier-check": "prettier --check ." 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/LuigiZaccagnini/octo.git" 23 | }, 24 | "keywords": [ 25 | "ssg", 26 | "static", 27 | "site", 28 | "generator" 29 | ], 30 | "author": "Luigi Zaccagnini (https://luigizaccagnini.com/)", 31 | "license": "GPL-3.0-or-later", 32 | "bugs": { 33 | "url": "https://github.com/LuigiZaccagnini/octo/issues" 34 | }, 35 | "homepage": "https://github.com/LuigiZaccagnini/octo#readme", 36 | "dependencies": { 37 | "boxen": "^4.2.0", 38 | "chalk": "2.4", 39 | "enzyme": "^3.9.0", 40 | "react": "^16.8.6", 41 | "react-dom": "^16.8.6", 42 | "react-test-renderer": "^17.0.2", 43 | "showdown": "^1.9.0", 44 | "yargs": "^17.2.1" 45 | }, 46 | "devDependencies": { 47 | "eslint": "^8.1.0", 48 | "husky": "^7.0.4", 49 | "jest": "^27.3.1", 50 | "prettier": "2.4.1" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /test/__snapshots__/fileFunction.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Markdown to HTML renders correctly 1`] = ` 4 | "Filename

Markdown: Syntax

5 | 26 |

Note: This document is itself written using Markdown; you
27 | can see the source for it by adding '.text' to the URL.

28 |
29 |

Overview

30 |

Philosophy

31 |

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

32 |

Readability, however, is emphasized above all else. A Markdown-formatted
33 | document should be publishable as-is, as plain text, without looking
34 | like it's been marked up with tags or formatting instructions. While
35 | Markdown's syntax has been influenced by several existing text-to-HTML
36 | filters -- including Setext, atx, Textile, reStructuredText,
37 | Grutatext, and EtText -- the single biggest source of
38 | inspiration for Markdown's syntax is the format of plain text email.

39 |

Block Elements

40 |

Paragraphs and Line Breaks

41 |

A paragraph is simply one or more consecutive lines of text, separated
42 | by one or more blank lines. (A blank line is any line that looks like a
43 | blank line -- a line containing nothing but spaces or tabs is considered
44 | blank.) Normal paragraphs should not be indented with spaces or tabs.

45 |

The implication of the \\"one or more consecutive lines of text\\" rule is
46 | that Markdown supports \\"hard-wrapped\\" text paragraphs. This differs
47 | significantly from most other text-to-HTML formatters (including Movable
48 | Type's \\"Convert Line Breaks\\" option) which translate every line break
49 | character in a paragraph into a <br /> tag.

50 |

When you do want to insert a <br /> break tag using Markdown, you
51 | end a line with two or more spaces, then type return.

52 |

Headers

53 |

Markdown supports two styles of headers, [Setext] [1] and [atx] [2].

54 |

Optionally, you may \\"close\\" atx-style headers. This is purely
55 | cosmetic -- you can use this if you think it looks better. The
56 | closing hashes don't even need to match the number of hashes
57 | used to open the header. (The number of opening hashes
58 | determines the header level.)

59 |

Blockquotes

60 |

Markdown uses email-style > characters for blockquoting. If you're
61 | familiar with quoting passages of text in an email message, then you
62 | know how to create a blockquote in Markdown. It looks best if you hard
63 | wrap the text and put a > before every line:

64 |
65 |

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
66 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
67 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

68 |

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
69 | id sem consectetuer libero luctus adipiscing.

70 |
71 |

Markdown allows you to be lazy and only put the > before the first
72 | line of a hard-wrapped paragraph:

73 |
74 |

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
75 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
76 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

77 |
78 |
79 |

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
80 | id sem consectetuer libero luctus adipiscing.

81 |
82 |

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
83 | adding additional levels of >:

84 |
85 |

This is the first level of quoting.

86 |
87 |

This is nested blockquote.

88 |
89 |

Back to the first level.

90 |
91 |

Blockquotes can contain other Markdown elements, including headers, lists,
92 | and code blocks:

93 |
94 |

This is a header.

95 |
    96 |
  1. This is the first list item.
  2. 97 |
  3. This is the second list item.
  4. 98 |
99 |

Here's some example code:

100 |
return shell_exec(\\"echo $input | $markdown_script\\");
101 |
102 |

Any decent text editor should make email-style quoting easy. For
103 | example, with BBEdit, you can make a selection and choose Increase
104 | Quote Level from the Text menu.

105 |

Lists

106 |

Markdown supports ordered (numbered) and unordered (bulleted) lists.

107 |

Unordered lists use asterisks, pluses, and hyphens -- interchangably
108 | -- as list markers:

109 |
    110 |
  • Red
  • 111 |
  • Green
  • 112 |
  • Blue
  • 113 |
114 |

is equivalent to:

115 |
    116 |
  • Red
  • 117 |
  • Green
  • 118 |
  • Blue
  • 119 |
120 |

and:

121 |
    122 |
  • Red
  • 123 |
  • Green
  • 124 |
  • Blue
  • 125 |
126 |

Ordered lists use numbers followed by periods:

127 |
    128 |
  1. Bird
  2. 129 |
  3. McHale
  4. 130 |
  5. Parish
  6. 131 |
132 |

It's important to note that the actual numbers you use to mark the
133 | list have no effect on the HTML output Markdown produces. The HTML
134 | Markdown produces from the above list is:

135 |

If you instead wrote the list in Markdown like this:

136 |
    137 |
  1. Bird
  2. 138 |
  3. McHale
  4. 139 |
  5. Parish
  6. 140 |
141 |

or even:

142 |
    143 |
  1. Bird
  2. 144 |
  3. McHale
  4. 145 |
  5. Parish
  6. 146 |
147 |

you'd get the exact same HTML output. The point is, if you want to,
148 | you can use ordinal numbers in your ordered Markdown lists, so that
149 | the numbers in your source match the numbers in your published HTML.
150 | But if you want to be lazy, you don't have to.

151 |

To make lists look nice, you can wrap items with hanging indents:

152 |
    153 |
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    154 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    155 | viverra nec, fringilla in, laoreet vitae, risus.
  • 156 |
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    157 | Suspendisse id sem consectetuer libero luctus adipiscing.
  • 158 |
159 |

But if you want to be lazy, you don't have to:

160 |
    161 |
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    162 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    163 | viverra nec, fringilla in, laoreet vitae, risus.
  • 164 |
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    165 | Suspendisse id sem consectetuer libero luctus adipiscing.
  • 166 |
167 |

List items may consist of multiple paragraphs. Each subsequent
168 | paragraph in a list item must be indented by either 4 spaces
169 | or one tab:

170 |
    171 |
  1. This is a list item with two paragraphs. Lorem ipsum dolor
    172 | sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    173 | mi posuere lectus.

    174 |

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    175 | vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    176 | sit amet velit.

  2. 177 |
  3. Suspendisse id sem consectetuer libero luctus adipiscing.

  4. 178 |
179 |

It looks nice if you indent every line of the subsequent
180 | paragraphs, but here again, Markdown will allow you to be
181 | lazy:

182 |
    183 |
  • This is a list item with two paragraphs.

    184 |

    This is the second paragraph in the list item. You're
    185 | only required to indent the first line. Lorem ipsum dolor
    186 | sit amet, consectetuer adipiscing elit.

  • 187 |
  • Another item in the same list.

  • 188 |
189 |

To put a blockquote within a list item, the blockquote's >
190 | delimiters need to be indented:

191 |
    192 |
  • A list item with a blockquote:

    193 |
    194 |

    This is a blockquote
    195 | inside a list item.

    196 |
  • 197 |
198 |

To put a code block within a list item, the code block needs
199 | to be indented twice -- 8 spaces or two tabs:

200 |
    201 |
  • A list item with a code block:

    202 |
    <code goes here>
  • 203 |
204 |

Code Blocks

205 |

Pre-formatted code blocks are used for writing about programming or
206 | markup source code. Rather than forming normal paragraphs, the lines
207 | of a code block are interpreted literally. Markdown wraps a code block
208 | in both <pre> and <code> tags.

209 |

To produce a code block in Markdown, simply indent every line of the
210 | block by at least 4 spaces or 1 tab.

211 |

This is a normal paragraph:

212 |
This is a code block.
213 |

Here is an example of AppleScript:

214 |
tell application \\"Foo\\"
215 |     beep
216 | end tell
217 |

A code block continues until it reaches a line that is not indented
218 | (or the end of the article).

219 |

Within a code block, ampersands (&) and angle brackets (< and >)
220 | are automatically converted into HTML entities. This makes it very
221 | easy to include example HTML source code using Markdown -- just paste
222 | it and indent it, and Markdown will handle the hassle of encoding the
223 | ampersands and angle brackets. For example, this:

224 |
<div class=\\"footer\\">
225 |     &copy; 2004 Foo Corporation
226 | </div>
227 |

Regular Markdown syntax is not processed within code blocks. E.g.,
228 | asterisks are just literal asterisks within a code block. This means
229 | it's also easy to use Markdown to write about Markdown's own syntax.

230 |
tell application \\"Foo\\"
231 |     beep
232 | end tell
233 |

Span Elements

234 |

Links

235 |

Markdown supports two style of links: inline and reference.

236 |

In both styles, the link text is delimited by [square brackets].

237 |

To create an inline link, use a set of regular parentheses immediately
238 | after the link text's closing square bracket. Inside the parentheses,
239 | put the URL where you want the link to point, along with an optional
240 | title for the link, surrounded in quotes. For example:

241 |

This is an example inline link.

242 |

This link has no title attribute.

243 |

Emphasis

244 |

Markdown treats asterisks (*) and underscores (_) as indicators of
245 | emphasis. Text wrapped with one * or _ will be wrapped with an
246 | HTML <em> tag; double *'s or _'s will be wrapped with an HTML
247 | <strong> tag. E.g., this input:

248 |

single asterisks

249 |

single underscores

250 |

double asterisks

251 |

double underscores

252 |

Code

253 |

To indicate a span of code, wrap it with backtick quotes (\`).
254 | Unlike a pre-formatted code block, a code span indicates code within a
255 | normal paragraph. For example:

256 |

Use the printf() function.

" 257 | `; 258 | 259 | exports[`Markdown to HTML renders correctly with language option 1`] = ` 260 | "Filename

Markdown: Syntax

261 | 282 |

Note: This document is itself written using Markdown; you
283 | can see the source for it by adding '.text' to the URL.

284 |
285 |

Overview

286 |

Philosophy

287 |

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

288 |

Readability, however, is emphasized above all else. A Markdown-formatted
289 | document should be publishable as-is, as plain text, without looking
290 | like it's been marked up with tags or formatting instructions. While
291 | Markdown's syntax has been influenced by several existing text-to-HTML
292 | filters -- including Setext, atx, Textile, reStructuredText,
293 | Grutatext, and EtText -- the single biggest source of
294 | inspiration for Markdown's syntax is the format of plain text email.

295 |

Block Elements

296 |

Paragraphs and Line Breaks

297 |

A paragraph is simply one or more consecutive lines of text, separated
298 | by one or more blank lines. (A blank line is any line that looks like a
299 | blank line -- a line containing nothing but spaces or tabs is considered
300 | blank.) Normal paragraphs should not be indented with spaces or tabs.

301 |

The implication of the \\"one or more consecutive lines of text\\" rule is
302 | that Markdown supports \\"hard-wrapped\\" text paragraphs. This differs
303 | significantly from most other text-to-HTML formatters (including Movable
304 | Type's \\"Convert Line Breaks\\" option) which translate every line break
305 | character in a paragraph into a <br /> tag.

306 |

When you do want to insert a <br /> break tag using Markdown, you
307 | end a line with two or more spaces, then type return.

308 |

Headers

309 |

Markdown supports two styles of headers, [Setext] [1] and [atx] [2].

310 |

Optionally, you may \\"close\\" atx-style headers. This is purely
311 | cosmetic -- you can use this if you think it looks better. The
312 | closing hashes don't even need to match the number of hashes
313 | used to open the header. (The number of opening hashes
314 | determines the header level.)

315 |

Blockquotes

316 |

Markdown uses email-style > characters for blockquoting. If you're
317 | familiar with quoting passages of text in an email message, then you
318 | know how to create a blockquote in Markdown. It looks best if you hard
319 | wrap the text and put a > before every line:

320 |
321 |

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
322 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
323 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

324 |

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
325 | id sem consectetuer libero luctus adipiscing.

326 |
327 |

Markdown allows you to be lazy and only put the > before the first
328 | line of a hard-wrapped paragraph:

329 |
330 |

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
331 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
332 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

333 |
334 |
335 |

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
336 | id sem consectetuer libero luctus adipiscing.

337 |
338 |

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
339 | adding additional levels of >:

340 |
341 |

This is the first level of quoting.

342 |
343 |

This is nested blockquote.

344 |
345 |

Back to the first level.

346 |
347 |

Blockquotes can contain other Markdown elements, including headers, lists,
348 | and code blocks:

349 |
350 |

This is a header.

351 |
    352 |
  1. This is the first list item.
  2. 353 |
  3. This is the second list item.
  4. 354 |
355 |

Here's some example code:

356 |
return shell_exec(\\"echo $input | $markdown_script\\");
357 |
358 |

Any decent text editor should make email-style quoting easy. For
359 | example, with BBEdit, you can make a selection and choose Increase
360 | Quote Level from the Text menu.

361 |

Lists

362 |

Markdown supports ordered (numbered) and unordered (bulleted) lists.

363 |

Unordered lists use asterisks, pluses, and hyphens -- interchangably
364 | -- as list markers:

365 |
    366 |
  • Red
  • 367 |
  • Green
  • 368 |
  • Blue
  • 369 |
370 |

is equivalent to:

371 |
    372 |
  • Red
  • 373 |
  • Green
  • 374 |
  • Blue
  • 375 |
376 |

and:

377 |
    378 |
  • Red
  • 379 |
  • Green
  • 380 |
  • Blue
  • 381 |
382 |

Ordered lists use numbers followed by periods:

383 |
    384 |
  1. Bird
  2. 385 |
  3. McHale
  4. 386 |
  5. Parish
  6. 387 |
388 |

It's important to note that the actual numbers you use to mark the
389 | list have no effect on the HTML output Markdown produces. The HTML
390 | Markdown produces from the above list is:

391 |

If you instead wrote the list in Markdown like this:

392 |
    393 |
  1. Bird
  2. 394 |
  3. McHale
  4. 395 |
  5. Parish
  6. 396 |
397 |

or even:

398 |
    399 |
  1. Bird
  2. 400 |
  3. McHale
  4. 401 |
  5. Parish
  6. 402 |
403 |

you'd get the exact same HTML output. The point is, if you want to,
404 | you can use ordinal numbers in your ordered Markdown lists, so that
405 | the numbers in your source match the numbers in your published HTML.
406 | But if you want to be lazy, you don't have to.

407 |

To make lists look nice, you can wrap items with hanging indents:

408 |
    409 |
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    410 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    411 | viverra nec, fringilla in, laoreet vitae, risus.
  • 412 |
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    413 | Suspendisse id sem consectetuer libero luctus adipiscing.
  • 414 |
415 |

But if you want to be lazy, you don't have to:

416 |
    417 |
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    418 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    419 | viverra nec, fringilla in, laoreet vitae, risus.
  • 420 |
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    421 | Suspendisse id sem consectetuer libero luctus adipiscing.
  • 422 |
423 |

List items may consist of multiple paragraphs. Each subsequent
424 | paragraph in a list item must be indented by either 4 spaces
425 | or one tab:

426 |
    427 |
  1. This is a list item with two paragraphs. Lorem ipsum dolor
    428 | sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    429 | mi posuere lectus.

    430 |

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    431 | vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    432 | sit amet velit.

  2. 433 |
  3. Suspendisse id sem consectetuer libero luctus adipiscing.

  4. 434 |
435 |

It looks nice if you indent every line of the subsequent
436 | paragraphs, but here again, Markdown will allow you to be
437 | lazy:

438 |
    439 |
  • This is a list item with two paragraphs.

    440 |

    This is the second paragraph in the list item. You're
    441 | only required to indent the first line. Lorem ipsum dolor
    442 | sit amet, consectetuer adipiscing elit.

  • 443 |
  • Another item in the same list.

  • 444 |
445 |

To put a blockquote within a list item, the blockquote's >
446 | delimiters need to be indented:

447 |
    448 |
  • A list item with a blockquote:

    449 |
    450 |

    This is a blockquote
    451 | inside a list item.

    452 |
  • 453 |
454 |

To put a code block within a list item, the code block needs
455 | to be indented twice -- 8 spaces or two tabs:

456 |
    457 |
  • A list item with a code block:

    458 |
    <code goes here>
  • 459 |
460 |

Code Blocks

461 |

Pre-formatted code blocks are used for writing about programming or
462 | markup source code. Rather than forming normal paragraphs, the lines
463 | of a code block are interpreted literally. Markdown wraps a code block
464 | in both <pre> and <code> tags.

465 |

To produce a code block in Markdown, simply indent every line of the
466 | block by at least 4 spaces or 1 tab.

467 |

This is a normal paragraph:

468 |
This is a code block.
469 |

Here is an example of AppleScript:

470 |
tell application \\"Foo\\"
471 |     beep
472 | end tell
473 |

A code block continues until it reaches a line that is not indented
474 | (or the end of the article).

475 |

Within a code block, ampersands (&) and angle brackets (< and >)
476 | are automatically converted into HTML entities. This makes it very
477 | easy to include example HTML source code using Markdown -- just paste
478 | it and indent it, and Markdown will handle the hassle of encoding the
479 | ampersands and angle brackets. For example, this:

480 |
<div class=\\"footer\\">
481 |     &copy; 2004 Foo Corporation
482 | </div>
483 |

Regular Markdown syntax is not processed within code blocks. E.g.,
484 | asterisks are just literal asterisks within a code block. This means
485 | it's also easy to use Markdown to write about Markdown's own syntax.

486 |
tell application \\"Foo\\"
487 |     beep
488 | end tell
489 |

Span Elements

490 |

Links

491 |

Markdown supports two style of links: inline and reference.

492 |

In both styles, the link text is delimited by [square brackets].

493 |

To create an inline link, use a set of regular parentheses immediately
494 | after the link text's closing square bracket. Inside the parentheses,
495 | put the URL where you want the link to point, along with an optional
496 | title for the link, surrounded in quotes. For example:

497 |

This is an example inline link.

498 |

This link has no title attribute.

499 |

Emphasis

500 |

Markdown treats asterisks (*) and underscores (_) as indicators of
501 | emphasis. Text wrapped with one * or _ will be wrapped with an
502 | HTML <em> tag; double *'s or _'s will be wrapped with an HTML
503 | <strong> tag. E.g., this input:

504 |

single asterisks

505 |

single underscores

506 |

double asterisks

507 |

double underscores

508 |

Code

509 |

To indicate a span of code, wrap it with backtick quotes (\`).
510 | Unlike a pre-formatted code block, a code span indicates code within a
511 | normal paragraph. For example:

512 |

Use the printf() function.

" 513 | `; 514 | -------------------------------------------------------------------------------- /test/app.test.js: -------------------------------------------------------------------------------- 1 | const options = require('../bin/options'); 2 | 3 | const parsedArgs = (args) => { 4 | const argvs = options(args); 5 | return{ 6 | input: argvs.input, 7 | output: argvs.output, 8 | lang: argvs.lang 9 | }; 10 | }; 11 | 12 | describe("testing parsing arguments", () => { 13 | const defaultOptions = { 14 | input: 'path', 15 | output: './dist', 16 | lang: 'en_CA' 17 | } 18 | 19 | test ('passing single arguement', () => { 20 | expect(parsedArgs(['-i','path'])).toEqual(defaultOptions); 21 | }) 22 | 23 | test('full arguement options', () => { 24 | expect(parsedArgs(['-i','path', '-o', 'dist', '--lang','en_CA'])).toEqual({ 25 | input: 'path', 26 | output: 'dist', 27 | lang: 'en_CA' 28 | }); 29 | }); 30 | }); -------------------------------------------------------------------------------- /test/fileFunction.test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | const ff = require('../bin/fileFunctions'); 3 | const ReactTestRenderer = require('react-test-renderer'); 4 | 5 | test('Checks if it can add a directory', () => { 6 | expect(ff.addDirectory('./dist')).toBeUndefined(); 7 | }); 8 | 9 | it('Markdown to HTML renders correctly', () => { 10 | ff.markdownToHTML('test/markdownTest.md').then(html => { 11 | const tree = ReactTestRenderer.create(html).toJSON(); 12 | expect(tree).toMatchSnapshot(); 13 | }); 14 | }); 15 | 16 | it('Markdown to HTML renders correctly with language option', () => { 17 | ff.markdownToHTML('test/markdownTest.md', 'It').then(html => { 18 | const tree = ReactTestRenderer.create(html).toJSON(); 19 | expect(tree).toMatchSnapshot(); 20 | }); 21 | }); 22 | 23 | it('TEXT to HTML renders correctly', () => { 24 | ff.textToHTML('test/testing.txt').then(html => { 25 | const tree = ReactTestRenderer.create(html).toJSON(); 26 | expect(tree).toBeTruthy(); 27 | }); 28 | }); 29 | 30 | test('Checks if it lineChecker filter without first line', () => { 31 | expect(ff.lineChecker('Hello World', false)).toBe('

Hello World

'); 32 | }); 33 | 34 | test('Checks if it lineChecker filter with first line', () => { 35 | expect(ff.lineChecker('Hello World', true)).toBe('

Hello World

'); 36 | }); 37 | 38 | test('Checks if it lineChecker filters a empty line', () => { 39 | expect(ff.lineChecker('', false)).toBe('
'); 40 | }); -------------------------------------------------------------------------------- /test/markdownTest.md: -------------------------------------------------------------------------------- 1 | # Markdown: Syntax 2 | 3 | * [Overview](#overview) 4 | * [Philosophy](#philosophy) 5 | * [Inline HTML](#html) 6 | * [Automatic Escaping for Special Characters](#autoescape) 7 | * [Block Elements](#block) 8 | * [Paragraphs and Line Breaks](#p) 9 | * [Headers](#header) 10 | * [Blockquotes](#blockquote) 11 | * [Lists](#list) 12 | * [Code Blocks](#precode) 13 | * [Horizontal Rules](#hr) 14 | * [Span Elements](#span) 15 | * [Links](#link) 16 | * [Emphasis](#em) 17 | * [Code](#code) 18 | * [Images](#img) 19 | * [Miscellaneous](#misc) 20 | * [Backslash Escapes](#backslash) 21 | * [Automatic Links](#autolink) 22 | 23 | 24 | **Note:** This document is itself written using Markdown; you 25 | can [see the source for it by adding '.text' to the URL](/projects/markdown/syntax.text). 26 | 27 | ---- 28 | 29 | ## Overview 30 | 31 | ### Philosophy 32 | 33 | Markdown is intended to be as easy-to-read and easy-to-write as is feasible. 34 | 35 | Readability, however, is emphasized above all else. A Markdown-formatted 36 | document should be publishable as-is, as plain text, without looking 37 | like it's been marked up with tags or formatting instructions. While 38 | Markdown's syntax has been influenced by several existing text-to-HTML 39 | filters -- including [Setext](http://docutils.sourceforge.net/mirror/setext.html), [atx](http://www.aaronsw.com/2002/atx/), [Textile](http://textism.com/tools/textile/), [reStructuredText](http://docutils.sourceforge.net/rst.html), 40 | [Grutatext](http://www.triptico.com/software/grutatxt.html), and [EtText](http://ettext.taint.org/doc/) -- the single biggest source of 41 | inspiration for Markdown's syntax is the format of plain text email. 42 | 43 | ## Block Elements 44 | 45 | ### Paragraphs and Line Breaks 46 | 47 | A paragraph is simply one or more consecutive lines of text, separated 48 | by one or more blank lines. (A blank line is any line that looks like a 49 | blank line -- a line containing nothing but spaces or tabs is considered 50 | blank.) Normal paragraphs should not be indented with spaces or tabs. 51 | 52 | The implication of the "one or more consecutive lines of text" rule is 53 | that Markdown supports "hard-wrapped" text paragraphs. This differs 54 | significantly from most other text-to-HTML formatters (including Movable 55 | Type's "Convert Line Breaks" option) which translate every line break 56 | character in a paragraph into a `
` tag. 57 | 58 | When you *do* want to insert a `
` break tag using Markdown, you 59 | end a line with two or more spaces, then type return. 60 | 61 | ### Headers 62 | 63 | Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. 64 | 65 | Optionally, you may "close" atx-style headers. This is purely 66 | cosmetic -- you can use this if you think it looks better. The 67 | closing hashes don't even need to match the number of hashes 68 | used to open the header. (The number of opening hashes 69 | determines the header level.) 70 | 71 | 72 | ### Blockquotes 73 | 74 | Markdown uses email-style `>` characters for blockquoting. If you're 75 | familiar with quoting passages of text in an email message, then you 76 | know how to create a blockquote in Markdown. It looks best if you hard 77 | wrap the text and put a `>` before every line: 78 | 79 | > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, 80 | > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. 81 | > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 82 | > 83 | > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse 84 | > id sem consectetuer libero luctus adipiscing. 85 | 86 | Markdown allows you to be lazy and only put the `>` before the first 87 | line of a hard-wrapped paragraph: 88 | 89 | > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, 90 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. 91 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 92 | 93 | > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse 94 | id sem consectetuer libero luctus adipiscing. 95 | 96 | Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by 97 | adding additional levels of `>`: 98 | 99 | > This is the first level of quoting. 100 | > 101 | > > This is nested blockquote. 102 | > 103 | > Back to the first level. 104 | 105 | Blockquotes can contain other Markdown elements, including headers, lists, 106 | and code blocks: 107 | 108 | > ## This is a header. 109 | > 110 | > 1. This is the first list item. 111 | > 2. This is the second list item. 112 | > 113 | > Here's some example code: 114 | > 115 | > return shell_exec("echo $input | $markdown_script"); 116 | 117 | Any decent text editor should make email-style quoting easy. For 118 | example, with BBEdit, you can make a selection and choose Increase 119 | Quote Level from the Text menu. 120 | 121 | 122 | ### Lists 123 | 124 | Markdown supports ordered (numbered) and unordered (bulleted) lists. 125 | 126 | Unordered lists use asterisks, pluses, and hyphens -- interchangably 127 | -- as list markers: 128 | 129 | * Red 130 | * Green 131 | * Blue 132 | 133 | is equivalent to: 134 | 135 | + Red 136 | + Green 137 | + Blue 138 | 139 | and: 140 | 141 | - Red 142 | - Green 143 | - Blue 144 | 145 | Ordered lists use numbers followed by periods: 146 | 147 | 1. Bird 148 | 2. McHale 149 | 3. Parish 150 | 151 | It's important to note that the actual numbers you use to mark the 152 | list have no effect on the HTML output Markdown produces. The HTML 153 | Markdown produces from the above list is: 154 | 155 | If you instead wrote the list in Markdown like this: 156 | 157 | 1. Bird 158 | 1. McHale 159 | 1. Parish 160 | 161 | or even: 162 | 163 | 3. Bird 164 | 1. McHale 165 | 8. Parish 166 | 167 | you'd get the exact same HTML output. The point is, if you want to, 168 | you can use ordinal numbers in your ordered Markdown lists, so that 169 | the numbers in your source match the numbers in your published HTML. 170 | But if you want to be lazy, you don't have to. 171 | 172 | To make lists look nice, you can wrap items with hanging indents: 173 | 174 | * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 175 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, 176 | viverra nec, fringilla in, laoreet vitae, risus. 177 | * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. 178 | Suspendisse id sem consectetuer libero luctus adipiscing. 179 | 180 | But if you want to be lazy, you don't have to: 181 | 182 | * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 183 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, 184 | viverra nec, fringilla in, laoreet vitae, risus. 185 | * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. 186 | Suspendisse id sem consectetuer libero luctus adipiscing. 187 | 188 | List items may consist of multiple paragraphs. Each subsequent 189 | paragraph in a list item must be indented by either 4 spaces 190 | or one tab: 191 | 192 | 1. This is a list item with two paragraphs. Lorem ipsum dolor 193 | sit amet, consectetuer adipiscing elit. Aliquam hendrerit 194 | mi posuere lectus. 195 | 196 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet 197 | vitae, risus. Donec sit amet nisl. Aliquam semper ipsum 198 | sit amet velit. 199 | 200 | 2. Suspendisse id sem consectetuer libero luctus adipiscing. 201 | 202 | It looks nice if you indent every line of the subsequent 203 | paragraphs, but here again, Markdown will allow you to be 204 | lazy: 205 | 206 | * This is a list item with two paragraphs. 207 | 208 | This is the second paragraph in the list item. You're 209 | only required to indent the first line. Lorem ipsum dolor 210 | sit amet, consectetuer adipiscing elit. 211 | 212 | * Another item in the same list. 213 | 214 | To put a blockquote within a list item, the blockquote's `>` 215 | delimiters need to be indented: 216 | 217 | * A list item with a blockquote: 218 | 219 | > This is a blockquote 220 | > inside a list item. 221 | 222 | To put a code block within a list item, the code block needs 223 | to be indented *twice* -- 8 spaces or two tabs: 224 | 225 | * A list item with a code block: 226 | 227 | 228 | 229 | ### Code Blocks 230 | 231 | Pre-formatted code blocks are used for writing about programming or 232 | markup source code. Rather than forming normal paragraphs, the lines 233 | of a code block are interpreted literally. Markdown wraps a code block 234 | in both `
` and `` tags.
235 | 
236 | To produce a code block in Markdown, simply indent every line of the
237 | block by at least 4 spaces or 1 tab.
238 | 
239 | This is a normal paragraph:
240 | 
241 |     This is a code block.
242 | 
243 | Here is an example of AppleScript:
244 | 
245 |     tell application "Foo"
246 |         beep
247 |     end tell
248 | 
249 | A code block continues until it reaches a line that is not indented
250 | (or the end of the article).
251 | 
252 | Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
253 | are automatically converted into HTML entities. This makes it very
254 | easy to include example HTML source code using Markdown -- just paste
255 | it and indent it, and Markdown will handle the hassle of encoding the
256 | ampersands and angle brackets. For example, this:
257 | 
258 |     
261 | 
262 | Regular Markdown syntax is not processed within code blocks. E.g.,
263 | asterisks are just literal asterisks within a code block. This means
264 | it's also easy to use Markdown to write about Markdown's own syntax.
265 | 
266 | ```
267 | tell application "Foo"
268 |     beep
269 | end tell
270 | ```
271 | 
272 | ## Span Elements
273 | 
274 | ### Links
275 | 
276 | Markdown supports two style of links: *inline* and *reference*.
277 | 
278 | In both styles, the link text is delimited by [square brackets].
279 | 
280 | To create an inline link, use a set of regular parentheses immediately
281 | after the link text's closing square bracket. Inside the parentheses,
282 | put the URL where you want the link to point, along with an *optional*
283 | title for the link, surrounded in quotes. For example:
284 | 
285 | This is [an example](http://example.com/) inline link.
286 | 
287 | [This link](http://example.net/) has no title attribute.
288 | 
289 | ### Emphasis
290 | 
291 | Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
292 | emphasis. Text wrapped with one `*` or `_` will be wrapped with an
293 | HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML
294 | `` tag. E.g., this input:
295 | 
296 | *single asterisks*
297 | 
298 | _single underscores_
299 | 
300 | **double asterisks**
301 | 
302 | __double underscores__
303 | 
304 | ### Code
305 | 
306 | To indicate a span of code, wrap it with backtick quotes (`` ` ``).
307 | Unlike a pre-formatted code block, a code span indicates code within a
308 | normal paragraph. For example:
309 | 
310 | Use the `printf()` function.


--------------------------------------------------------------------------------
/test/testing.txt:
--------------------------------------------------------------------------------
1 | hello world


--------------------------------------------------------------------------------
/test/textTest.txt:
--------------------------------------------------------------------------------
  1 | # Markdown: Syntax
  2 | 
  3 | *   [Overview](#overview)
  4 |     *   [Philosophy](#philosophy)
  5 |     *   [Inline HTML](#html)
  6 |     *   [Automatic Escaping for Special Characters](#autoescape)
  7 | *   [Block Elements](#block)
  8 |     *   [Paragraphs and Line Breaks](#p)
  9 |     *   [Headers](#header)
 10 |     *   [Blockquotes](#blockquote)
 11 |     *   [Lists](#list)
 12 |     *   [Code Blocks](#precode)
 13 |     *   [Horizontal Rules](#hr)
 14 | *   [Span Elements](#span)
 15 |     *   [Links](#link)
 16 |     *   [Emphasis](#em)
 17 |     *   [Code](#code)
 18 |     *   [Images](#img)
 19 | *   [Miscellaneous](#misc)
 20 |     *   [Backslash Escapes](#backslash)
 21 |     *   [Automatic Links](#autolink)
 22 | 
 23 | 
 24 | **Note:** This document is itself written using Markdown; you
 25 | can [see the source for it by adding '.text' to the URL](/projects/markdown/syntax.text).
 26 | 
 27 | ----
 28 | 
 29 | ## Overview
 30 | 
 31 | ### Philosophy
 32 | 
 33 | Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
 34 | 
 35 | Readability, however, is emphasized above all else. A Markdown-formatted
 36 | document should be publishable as-is, as plain text, without looking
 37 | like it's been marked up with tags or formatting instructions. While
 38 | Markdown's syntax has been influenced by several existing text-to-HTML
 39 | filters -- including [Setext](http://docutils.sourceforge.net/mirror/setext.html), [atx](http://www.aaronsw.com/2002/atx/), [Textile](http://textism.com/tools/textile/), [reStructuredText](http://docutils.sourceforge.net/rst.html),
 40 | [Grutatext](http://www.triptico.com/software/grutatxt.html), and [EtText](http://ettext.taint.org/doc/) -- the single biggest source of
 41 | inspiration for Markdown's syntax is the format of plain text email.
 42 | 
 43 | ## Block Elements
 44 | 
 45 | ### Paragraphs and Line Breaks
 46 | 
 47 | A paragraph is simply one or more consecutive lines of text, separated
 48 | by one or more blank lines. (A blank line is any line that looks like a
 49 | blank line -- a line containing nothing but spaces or tabs is considered
 50 | blank.) Normal paragraphs should not be indented with spaces or tabs.
 51 | 
 52 | The implication of the "one or more consecutive lines of text" rule is
 53 | that Markdown supports "hard-wrapped" text paragraphs. This differs
 54 | significantly from most other text-to-HTML formatters (including Movable
 55 | Type's "Convert Line Breaks" option) which translate every line break
 56 | character in a paragraph into a `
` tag. 57 | 58 | When you *do* want to insert a `
` break tag using Markdown, you 59 | end a line with two or more spaces, then type return. 60 | 61 | ### Headers 62 | 63 | Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. 64 | 65 | Optionally, you may "close" atx-style headers. This is purely 66 | cosmetic -- you can use this if you think it looks better. The 67 | closing hashes don't even need to match the number of hashes 68 | used to open the header. (The number of opening hashes 69 | determines the header level.) 70 | 71 | 72 | ### Blockquotes 73 | 74 | Markdown uses email-style `>` characters for blockquoting. If you're 75 | familiar with quoting passages of text in an email message, then you 76 | know how to create a blockquote in Markdown. It looks best if you hard 77 | wrap the text and put a `>` before every line: 78 | 79 | > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, 80 | > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. 81 | > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 82 | > 83 | > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse 84 | > id sem consectetuer libero luctus adipiscing. 85 | 86 | Markdown allows you to be lazy and only put the `>` before the first 87 | line of a hard-wrapped paragraph: 88 | 89 | > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, 90 | consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. 91 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. 92 | 93 | > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse 94 | id sem consectetuer libero luctus adipiscing. 95 | 96 | Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by 97 | adding additional levels of `>`: 98 | 99 | > This is the first level of quoting. 100 | > 101 | > > This is nested blockquote. 102 | > 103 | > Back to the first level. 104 | 105 | Blockquotes can contain other Markdown elements, including headers, lists, 106 | and code blocks: 107 | 108 | > ## This is a header. 109 | > 110 | > 1. This is the first list item. 111 | > 2. This is the second list item. 112 | > 113 | > Here's some example code: 114 | > 115 | > return shell_exec("echo $input | $markdown_script"); 116 | 117 | Any decent text editor should make email-style quoting easy. For 118 | example, with BBEdit, you can make a selection and choose Increase 119 | Quote Level from the Text menu. 120 | 121 | 122 | ### Lists 123 | 124 | Markdown supports ordered (numbered) and unordered (bulleted) lists. 125 | 126 | Unordered lists use asterisks, pluses, and hyphens -- interchangably 127 | -- as list markers: 128 | 129 | * Red 130 | * Green 131 | * Blue 132 | 133 | is equivalent to: 134 | 135 | + Red 136 | + Green 137 | + Blue 138 | 139 | and: 140 | 141 | - Red 142 | - Green 143 | - Blue 144 | 145 | Ordered lists use numbers followed by periods: 146 | 147 | 1. Bird 148 | 2. McHale 149 | 3. Parish 150 | 151 | It's important to note that the actual numbers you use to mark the 152 | list have no effect on the HTML output Markdown produces. The HTML 153 | Markdown produces from the above list is: 154 | 155 | If you instead wrote the list in Markdown like this: 156 | 157 | 1. Bird 158 | 1. McHale 159 | 1. Parish 160 | 161 | or even: 162 | 163 | 3. Bird 164 | 1. McHale 165 | 8. Parish 166 | 167 | you'd get the exact same HTML output. The point is, if you want to, 168 | you can use ordinal numbers in your ordered Markdown lists, so that 169 | the numbers in your source match the numbers in your published HTML. 170 | But if you want to be lazy, you don't have to. 171 | 172 | To make lists look nice, you can wrap items with hanging indents: 173 | 174 | * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 175 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, 176 | viverra nec, fringilla in, laoreet vitae, risus. 177 | * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. 178 | Suspendisse id sem consectetuer libero luctus adipiscing. 179 | 180 | But if you want to be lazy, you don't have to: 181 | 182 | * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 183 | Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, 184 | viverra nec, fringilla in, laoreet vitae, risus. 185 | * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. 186 | Suspendisse id sem consectetuer libero luctus adipiscing. 187 | 188 | List items may consist of multiple paragraphs. Each subsequent 189 | paragraph in a list item must be indented by either 4 spaces 190 | or one tab: 191 | 192 | 1. This is a list item with two paragraphs. Lorem ipsum dolor 193 | sit amet, consectetuer adipiscing elit. Aliquam hendrerit 194 | mi posuere lectus. 195 | 196 | Vestibulum enim wisi, viverra nec, fringilla in, laoreet 197 | vitae, risus. Donec sit amet nisl. Aliquam semper ipsum 198 | sit amet velit. 199 | 200 | 2. Suspendisse id sem consectetuer libero luctus adipiscing. 201 | 202 | It looks nice if you indent every line of the subsequent 203 | paragraphs, but here again, Markdown will allow you to be 204 | lazy: 205 | 206 | * This is a list item with two paragraphs. 207 | 208 | This is the second paragraph in the list item. You're 209 | only required to indent the first line. Lorem ipsum dolor 210 | sit amet, consectetuer adipiscing elit. 211 | 212 | * Another item in the same list. 213 | 214 | To put a blockquote within a list item, the blockquote's `>` 215 | delimiters need to be indented: 216 | 217 | * A list item with a blockquote: 218 | 219 | > This is a blockquote 220 | > inside a list item. 221 | 222 | To put a code block within a list item, the code block needs 223 | to be indented *twice* -- 8 spaces or two tabs: 224 | 225 | * A list item with a code block: 226 | 227 | 228 | 229 | ### Code Blocks 230 | 231 | Pre-formatted code blocks are used for writing about programming or 232 | markup source code. Rather than forming normal paragraphs, the lines 233 | of a code block are interpreted literally. Markdown wraps a code block 234 | in both `
` and `` tags.
235 | 
236 | To produce a code block in Markdown, simply indent every line of the
237 | block by at least 4 spaces or 1 tab.
238 | 
239 | This is a normal paragraph:
240 | 
241 |     This is a code block.
242 | 
243 | Here is an example of AppleScript:
244 | 
245 |     tell application "Foo"
246 |         beep
247 |     end tell
248 | 
249 | A code block continues until it reaches a line that is not indented
250 | (or the end of the article).
251 | 
252 | Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
253 | are automatically converted into HTML entities. This makes it very
254 | easy to include example HTML source code using Markdown -- just paste
255 | it and indent it, and Markdown will handle the hassle of encoding the
256 | ampersands and angle brackets. For example, this:
257 | 
258 |     
261 | 
262 | Regular Markdown syntax is not processed within code blocks. E.g.,
263 | asterisks are just literal asterisks within a code block. This means
264 | it's also easy to use Markdown to write about Markdown's own syntax.
265 | 
266 | ```
267 | tell application "Foo"
268 |     beep
269 | end tell
270 | ```
271 | 
272 | ## Span Elements
273 | 
274 | ### Links
275 | 
276 | Markdown supports two style of links: *inline* and *reference*.
277 | 
278 | In both styles, the link text is delimited by [square brackets].
279 | 
280 | To create an inline link, use a set of regular parentheses immediately
281 | after the link text's closing square bracket. Inside the parentheses,
282 | put the URL where you want the link to point, along with an *optional*
283 | title for the link, surrounded in quotes. For example:
284 | 
285 | This is [an example](http://example.com/) inline link.
286 | 
287 | [This link](http://example.net/) has no title attribute.
288 | 
289 | ### Emphasis
290 | 
291 | Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
292 | emphasis. Text wrapped with one `*` or `_` will be wrapped with an
293 | HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML
294 | `` tag. E.g., this input:
295 | 
296 | *single asterisks*
297 | 
298 | _single underscores_
299 | 
300 | **double asterisks**
301 | 
302 | __double underscores__
303 | 
304 | ### Code
305 | 
306 | To indicate a span of code, wrap it with backtick quotes (`` ` ``).
307 | Unlike a pre-formatted code block, a code span indicates code within a
308 | normal paragraph. For example:
309 | 
310 | Use the `printf()` function.


--------------------------------------------------------------------------------