diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2020-03-27 16:11:06 +0000 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2020-03-27 16:11:06 +0000 |
| commit | c09305bfcf14707ef8c6b46e4e39a03c42a5c746 (patch) | |
| tree | cd04679b5fef0feac617d54b96636327a403a38c | |
| parent | 2d30971007ebc6a9a8c63f03504e5ff66667201c (diff) | |
Add post creating_an_ebook_with_markdown
| -rw-r--r-- | source/_assets/sass/_base.scss | 13 | ||||
| -rw-r--r-- | source/_assets/sass/_blog.scss | 15 | ||||
| -rw-r--r-- | source/_assets/sass/_tags.scss | 5 | ||||
| -rw-r--r-- | source/_layouts/post.blade.php | 2 | ||||
| -rw-r--r-- | source/_posts/creating_an_ebook_with_markdown.md | 79 | ||||
| -rw-r--r-- | source/_posts/welcome.md | 12 | ||||
| -rw-r--r-- | source/_tags/markdown.md | 4 | ||||
| -rw-r--r-- | source/assets/build/css/main.css | 37 | ||||
| -rw-r--r-- | source/assets/build/mix-manifest.json | 2 | ||||
| -rw-r--r-- | source/assets/files/example_ebook.zip | bin | 0 -> 13042 bytes | |||
| -rw-r--r-- | source/assets/files/temp/example_ebook.zip | bin | 0 -> 26004 bytes |
11 files changed, 150 insertions, 19 deletions
diff --git a/source/_assets/sass/_base.scss b/source/_assets/sass/_base.scss index 77559ee..35dafee 100644 --- a/source/_assets/sass/_base.scss +++ b/source/_assets/sass/_base.scss @@ -3,13 +3,24 @@ body { @apply text-white; } +p { + @apply .my-3; +} + +code { + background-color: #232323; + @apply .px-2; + @apply .py-px; + @apply .rounded; + @apply .text-sm; +} + pre { @apply .bg-gray-800; @apply .my-4; @apply .overflow-x-auto; code.hljs { - @apply .bg-transparent; } } diff --git a/source/_assets/sass/_blog.scss b/source/_assets/sass/_blog.scss index 7e3d82e..a55901b 100644 --- a/source/_assets/sass/_blog.scss +++ b/source/_assets/sass/_blog.scss @@ -32,14 +32,29 @@ @apply font-bold; @apply my-4; } + h3 { @apply text-xl; @apply font-bold; @apply my-4; } + a { @apply text-green-600; } + + ol, + ul { + @apply .list-inside; + } + + ol { + @apply .list-decimal; + } + + ul { + @apply .list-disc; + } } } diff --git a/source/_assets/sass/_tags.scss b/source/_assets/sass/_tags.scss index 922e4c9..fc7e5ec 100644 --- a/source/_assets/sass/_tags.scss +++ b/source/_assets/sass/_tags.scss @@ -10,6 +10,11 @@ @apply text-black; } + &.markdown { + background-color: #FFFFFF; + @apply text-black; + } + &.mysql { background-color: #F29221; @apply text-white; diff --git a/source/_layouts/post.blade.php b/source/_layouts/post.blade.php index 9b2b6c5..faaf2ea 100644 --- a/source/_layouts/post.blade.php +++ b/source/_layouts/post.blade.php @@ -5,7 +5,7 @@ <header class="sm:flex sm:flex-row sm:justify-between p-4 pb-8 border-b border-green-100 border-dashed mb-8"> <div> <h1 class="text-green-300 text-3xl font-bold">{{$page->title }}</h1> - <p class="text-2xl">{{ $page->description }}</p> + <p class="text-green-600 text-2xl">{{ $page->description }}</p> </div> <div class="mt-8 sm:mt-0 text-right flex flex-row sm:flex-col"> <time class="inline-block p-2 order-2 sm:order-1 ml-2" datetime="{{ $page->getDate()->format('Y-m-d') }}"> diff --git a/source/_posts/creating_an_ebook_with_markdown.md b/source/_posts/creating_an_ebook_with_markdown.md new file mode 100644 index 0000000..29519bb --- /dev/null +++ b/source/_posts/creating_an_ebook_with_markdown.md @@ -0,0 +1,79 @@ +--- +extends: _layouts.post +section: content +title: Creating an Ebook With Markdown +date: 2020-03-30 +description: Use Markdown to Create an Ebook That Can Be Read on Various Devices +tags: [Markdown] +--- + +[Pandoc](https://pandoc.org/) is a great tool for converting a file in one markup format into another. This means we can use it to convert a file written in [Markdown](https://en.wikipedia.org/wiki/Markdown) into an [EPUB](https://en.wikipedia.org/wiki/EPUB) file that is supported by many e-readers. + +Lets start by writting a very simple markdown file called `example_ebook.md`. + +```markdown +--- +title: +- type: main + text: Example Ebook +- type: subtitle + text: An Ebook created from a Markdown file +creator: +- role: author + text: David Sadler +publisher: Published by myself +--- + +This is an introduction. + +# Chapter 1 + +This is the first paragraph of chapter 1. + +This is the second paragraph of chapter 1. + +Below is a list. + +- Item One +- Item Two +- Item Three + +# Chapter 2 + +This is the first paragraph of chapter 2. + +This is the second paragraph of chapter 2. + +# Chapter 3 + +This is the first paragraph of chapter 3. + +This is the second paragraph of chapter 3. +``` + +Note that the file begins with a [YAML metadata block](https://pandoc.org/MANUAL.html#extension-yaml_metadata_block) that starts and ends with three hyphens (`---`). This allows you to specify [EPUB metadata](https://pandoc.org/MANUAL.html#epub-metadata) such as the title and author. + +Converting this to EPUB is done by running pandoc. + +```shell +$ pandoc example_ebook.md -t epub3 --toc -o example_ebook.epub +``` + +There are several options that need to be passed to pandoc. + +- `example_ebook.md` — This argument is the file that you are converting. +- `-t epub3` — Set the output format to be [EPUB v3 book](https://www.w3.org/community/epub3/). +- `--toc` — Include a table of contents in the output document. This will be derived from the H1 headers in the markdown. +- `-o example_ebook.epub` — Tell pandoc to output the conversion to the named file instead of *stdout*. + +You can now copy the file `example_ebook.epub` to any device that supports the format or use one of the many software readers such as [Calibre](https://calibre-ebook.com/). However, if you wish to read this on a Kindle device you will need to convert it to the [Mobi](https://en.wikipedia.org/wiki/Comparison_of_e-book_formats#Mobipocket) format. + +Amazon provides a command line tool called [KindleGen](https://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211) that can convert our EPUB file into the Mobi format. After downloading the tool just run it as shown below. + +```shell +$ kindlegen example_ebook.epub +``` + +This will create a file called `example_ebook.mobi` that you can copy to your Kindle to read. + +There is a [zip file](/assets/files/example_ebook.zip) available that contains all the example files. diff --git a/source/_posts/welcome.md b/source/_posts/welcome.md deleted file mode 100644 index 02473da..0000000 --- a/source/_posts/welcome.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -extends: _layouts.post -section: content -title: Welcome -date: 2020-03-08 -description: My first post on my redesigned blog -tags: [Jigsaw] ---- - -I've decided to take part in the [four weeks challenge](https://twitter.com/flaviocopes/status/1233393406556151808), that was announced by [@flaviocopes](https://twitter.com/flaviocopes), to get a blog up and running. - -This site was generated with [Jigsaw](https://jigsaw.tighten.co) and styled using [Taillwind CSS](https://tailwindcss.com). diff --git a/source/_tags/markdown.md b/source/_tags/markdown.md new file mode 100644 index 0000000..1d5c4ef --- /dev/null +++ b/source/_tags/markdown.md @@ -0,0 +1,4 @@ +--- +extends: _layouts.tag +description: All the Markdown posts +--- diff --git a/source/assets/build/css/main.css b/source/assets/build/css/main.css index 42fe88d..0487563 100644 --- a/source/assets/build/css/main.css +++ b/source/assets/build/css/main.css @@ -737,6 +737,21 @@ body { color: #fff; } +p { + margin-top: 0.75rem; + margin-bottom: 0.75rem; +} + +code { + background-color: #232323; + padding-left: 0.5rem; + padding-right: 0.5rem; + padding-top: 1px; + padding-bottom: 1px; + border-radius: 0.25rem; + font-size: 0.875rem; +} + pre { background-color: #2d3748; margin-top: 1rem; @@ -744,10 +759,6 @@ pre { overflow-x: auto; } -pre code.hljs { - background-color: transparent; -} - /* purgecss start ignore */ #main-sidebar-container a.apache { @@ -760,6 +771,11 @@ pre code.hljs { color: #000; } +#main-sidebar-container a.markdown { + background-color: #FFFFFF; + color: #000; +} + #main-sidebar-container a.mysql { background-color: #F29221; color: #fff; @@ -822,6 +838,19 @@ pre code.hljs { color: #38a169; } +#main-sidebar-container article ol, +#main-sidebar-container article ul { + list-style-position: inside; +} + +#main-sidebar-container article ol { + list-style-type: decimal; +} + +#main-sidebar-container article ul { + list-style-type: disc; +} + .sr-only{ position: absolute; width: 1px; diff --git a/source/assets/build/mix-manifest.json b/source/assets/build/mix-manifest.json index 72ae919..d888932 100644 --- a/source/assets/build/mix-manifest.json +++ b/source/assets/build/mix-manifest.json @@ -1,4 +1,4 @@ { "/js/main.js": "/js/main.js?id=c056074a8c43f32ffbad", - "/css/main.css": "/css/main.css?id=e69f839c8c514c603077" + "/css/main.css": "/css/main.css?id=f28813d42536f8c00d9b" } diff --git a/source/assets/files/example_ebook.zip b/source/assets/files/example_ebook.zip Binary files differnew file mode 100644 index 0000000..2f1c0f5 --- /dev/null +++ b/source/assets/files/example_ebook.zip diff --git a/source/assets/files/temp/example_ebook.zip b/source/assets/files/temp/example_ebook.zip Binary files differnew file mode 100644 index 0000000..ac7f71b --- /dev/null +++ b/source/assets/files/temp/example_ebook.zip |
