diff --git a/_posts/2020-09-28-twitter.md b/_posts/2020-09-28-twitter.md deleted file mode 100644 index e99c12d..0000000 --- a/_posts/2020-09-28-twitter.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: post -title: a post with twitter -date: 2020-09-28 11:12:00-0400 -description: an example of a blog post with twitter -tags: formatting -categories: sample-posts external-services ---- - -A sample blog page that demonstrates the inclusion of Tweets/Timelines/etc. - -# Tweet - -An example of displaying a tweet: -{% twitter https://twitter.com/rubygems/status/518821243320287232 %} - -# Timeline - -An example of pulling from a timeline: -{% twitter https://twitter.com/jekyllrb maxwidth=500 limit=3 %} - -# Additional Details - -For more details on using the plugin visit: [jekyll-twitter-plugin](https://github.com/rob-murray/jekyll-twitter-plugin) diff --git a/_posts/2021-07-04-diagrams.md b/_posts/2021-07-04-diagrams.md deleted file mode 100644 index c85baa2..0000000 --- a/_posts/2021-07-04-diagrams.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: post -title: a post with diagrams -date: 2021-07-04 17:39:00 -tags: formatting diagrams -description: an example of a blog post with diagrams -mermaid: - enabled: true - zoomable: true ---- - -This theme supports generating various diagrams from a text description using [mermaid](https://mermaid-js.github.io/mermaid/){:target="\_blank"}. Previously, this was done using the [jekyll-diagrams](https://github.com/zhustec/jekyll-diagrams){:target="\_blank"} plugin. For more information on this matter, see the [related issue](https://github.com/alshedivat/al-folio/issues/1609#issuecomment-1656995674). To disable the zooming feature, set `mermaid.zoomable` to `false` in this post frontmatter. - -## Mermaid - -The diagram below was generated by the following code: - -````markdown -```mermaid -sequenceDiagram - participant John - participant Alice - Alice->>John: Hello John, how are you? - John-->>Alice: Great! -``` -```` - -```mermaid -sequenceDiagram - participant John - participant Alice - Alice->>John: Hello John, how are you? - John-->>Alice: Great! -``` diff --git a/_posts/2022-02-01-redirect.md b/_posts/2022-02-01-redirect.md deleted file mode 100644 index 62be5f3..0000000 --- a/_posts/2022-02-01-redirect.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -layout: post -title: a post with redirect -date: 2022-02-01 17:39:00 -description: you can also redirect to assets like pdf -redirect: /assets/pdf/example_pdf.pdf ---- - -Redirecting to another page. diff --git a/_posts/2022-12-10-giscus-comments.md b/_posts/2022-12-10-giscus-comments.md deleted file mode 100644 index 72e0847..0000000 --- a/_posts/2022-12-10-giscus-comments.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -layout: post -title: a post with giscus comments -date: 2022-12-10 11:59:00-0400 -description: an example of a blog post with giscus comments -tags: comments -categories: sample-posts external-services -giscus_comments: true -related_posts: false ---- - -This post shows how to add GISCUS comments. diff --git a/_posts/2023-03-20-table-of-contents.md b/_posts/2023-03-20-table-of-contents.md deleted file mode 100644 index ec91cd3..0000000 --- a/_posts/2023-03-20-table-of-contents.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -layout: post -title: a post with table of contents -date: 2023-03-20 11:59:00-0400 -description: an example of a blog post with table of contents -tags: formatting toc -categories: sample-posts -giscus_comments: true -related_posts: false -toc: - beginning: true ---- - -This post shows how to add a table of contents in the beginning of the post. - -## Adding a Table of Contents - -To add a table of contents to a post, simply add - -```yml -toc: - beginning: true -``` - -to the front matter of the post. The table of contents will be automatically generated from the headings in the post. - -### Example of Sub-Heading 1 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. - -### Example of another Sub-Heading 1 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. - -## Table of Contents Options - -If you want to learn more about how to customize the table of contents, you can check the [jekyll-toc](https://github.com/toshimaru/jekyll-toc) repository. - -### Example of Sub-Heading 2 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. - -### Example of another Sub-Heading 2 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. diff --git a/_posts/2023-03-21-tables.md b/_posts/2023-03-21-tables.md deleted file mode 100644 index da1d7e8..0000000 --- a/_posts/2023-03-21-tables.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -layout: post -title: displaying beautiful tables with Bootstrap Tables -date: 2023-03-20 14:37:00-0400 -description: an example of how to use Bootstrap Tables -tags: formatting tables -categories: sample-posts -giscus_comments: true -related_posts: true -pretty_table: true ---- - -Using markdown to display tables is easy. Just use the following syntax: - -```markdown -| Left aligned | Center aligned | Right aligned | -| :----------- | :------------: | ------------: | -| Left 1 | center 1 | right 1 | -| Left 2 | center 2 | right 2 | -| Left 3 | center 3 | right 3 | -``` - -That will generate: - -| Left aligned | Center aligned | Right aligned | -| :----------- | :------------: | ------------: | -| Left 1 | center 1 | right 1 | -| Left 2 | center 2 | right 2 | -| Left 3 | center 3 | right 3 | - -

- -It is also possible to use HTML to display tables. For example, the following HTML code will display a table with [Bootstrap Table](https://bootstrap-table.com/), loaded from a JSON file: - -{% raw %} - -```html - - - - - - - - -
IDItem NameItem Price
-``` - -{% endraw %} - - - - - - - - - -
IDItem NameItem Price
- -

- -By using [Bootstrap Table](https://bootstrap-table.com/) it is possible to create pretty complex tables, with pagination, search, and more. For example, the following HTML code will display a table, loaded from a JSON file, with pagination, search, checkboxes, and header/content alignment. For more information, check the [documentation](https://examples.bootstrap-table.com/index.html). - -{% raw %} - -```html - - - - - - - - - -
IDItem NameItem Price
-``` - -{% endraw %} - - - - - - - - - - -
IDItem NameItem Price
diff --git a/_posts/2023-04-24-videos.md b/_posts/2023-04-24-videos.md deleted file mode 100644 index d408d6b..0000000 --- a/_posts/2023-04-24-videos.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: post -title: a post with videos -date: 2023-04-24 21:01:00 -description: this is what included videos could look like -tags: formatting videos -categories: sample-posts ---- - -This is an example post with videos. It supports local video files. - -
-
- {% include video.liquid path="assets/video/pexels-engin-akyurt-6069112-960x540-30fps.mp4" class="img-fluid rounded z-depth-1" controls=true autoplay=true %} -
-
- {% include video.liquid path="assets/video/pexels-engin-akyurt-6069112-960x540-30fps.mp4" class="img-fluid rounded z-depth-1" controls=true %} -
-
-
- A simple, elegant caption looks good between video rows, after each row, or doesn't have to be there at all. -
- -It does also support embedding videos from different sources. Here are some examples: - -
-
- {% include video.liquid path="https://www.youtube.com/embed/jNQXAC9IVRw" class="img-fluid rounded z-depth-1" %} -
-
- {% include video.liquid path="https://player.vimeo.com/video/524933864?h=1ac4fd9fb4&title=0&byline=0&portrait=0" class="img-fluid rounded z-depth-1" %} -
-
diff --git a/_posts/2023-04-25-audios.md b/_posts/2023-04-25-audios.md deleted file mode 100644 index 1f3691c..0000000 --- a/_posts/2023-04-25-audios.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: post -title: a post with audios -date: 2023-04-25 10:25:00 -description: this is what included audios could look like -tags: formatting audios -categories: sample-posts ---- - -This is an example post with audios. It supports local audio files. - -
-
- {% include audio.liquid path="assets/audio/epicaly-short-113909.mp3" controls=true %} -
-
- {% include audio.liquid path="https://cdn.pixabay.com/download/audio/2022/06/25/audio_69a61cd6d6.mp3" controls=true %} -
-
-
- A simple, elegant caption looks good between video rows, after each row, or doesn't have to be there at all. -
diff --git a/_posts/2023-04-25-sidebar-table-of-contents.md b/_posts/2023-04-25-sidebar-table-of-contents.md deleted file mode 100644 index 2afb8fc..0000000 --- a/_posts/2023-04-25-sidebar-table-of-contents.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: post -title: a post with table of contents on a sidebar -date: 2023-04-25 10:14:00-0400 -description: an example of a blog post with table of contents on a sidebar -tags: formatting toc sidebar -categories: sample-posts -giscus_comments: true -related_posts: false -toc: - sidebar: left ---- - -This post shows how to add a table of contents as a sidebar. - -## Adding a Table of Contents - -To add a table of contents to a post as a sidebar, simply add - -```yml -toc: - sidebar: left -``` - -to the front matter of the post. The table of contents will be automatically generated from the headings in the post. If you wish to display the sidebar to the right, simply change `left` to `right`. - -### Example of Sub-Heading 1 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. - -### Example of another Sub-Heading 1 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. - -## Customizing Your Table of Contents - -{:data-toc-text="Customizing"} - -If you want to learn more about how to customize the table of contents of your sidebar, you can check the [bootstrap-toc](https://afeld.github.io/bootstrap-toc/) documentation. Notice that you can even customize the text of the heading that will be displayed on the sidebar. - -### Example of Sub-Heading 2 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. - -### Example of another Sub-Heading 2 - -Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. Pinterest DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade cold-pressed meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy. diff --git a/_posts/2023-05-12-custom-blockquotes.md b/_posts/2023-05-12-custom-blockquotes.md deleted file mode 100644 index fdaf47e..0000000 --- a/_posts/2023-05-12-custom-blockquotes.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -layout: post -title: a post with custom blockquotes -date: 2023-05-12 15:53:00-0400 -description: an example of a blog post with custom blockquotes -tags: formatting blockquotes -categories: sample-posts -giscus_comments: true -related_posts: true ---- - -This post shows how to add custom styles for blockquotes. Based on [jekyll-gitbook](https://github.com/sighingnow/jekyll-gitbook) implementation. - -We decided to support the same custom blockquotes as in [jekyll-gitbook](https://sighingnow.github.io/jekyll-gitbook/jekyll/2022-06-30-tips_warnings_dangers.html), which are also found in a lot of other sites' styles. The styles definitions can be found on the [\_base.scss](https://github.com/alshedivat/al-folio/blob/master/_sass/_base.scss) file, more specifically: - -```scss -/* Tips, warnings, and dangers */ -.post .post-content blockquote { - &.block-tip { - border-color: var(--global-tip-block); - background-color: var(--global-tip-block-bg); - - p { - color: var(--global-tip-block-text); - } - - h1, - h2, - h3, - h4, - h5, - h6 { - color: var(--global-tip-block-title); - } - } - - &.block-warning { - border-color: var(--global-warning-block); - background-color: var(--global-warning-block-bg); - - p { - color: var(--global-warning-block-text); - } - - h1, - h2, - h3, - h4, - h5, - h6 { - color: var(--global-warning-block-title); - } - } - - &.block-danger { - border-color: var(--global-danger-block); - background-color: var(--global-danger-block-bg); - - p { - color: var(--global-danger-block-text); - } - - h1, - h2, - h3, - h4, - h5, - h6 { - color: var(--global-danger-block-title); - } - } -} -``` - -A regular blockquote can be used as following: - -```markdown -> This is a regular blockquote -> and it can be used as usual -``` - -> This is a regular blockquote -> and it can be used as usual - -These custom styles can be used by adding the specific class to the blockquote, as follows: - - - -```markdown -> ##### TIP -> -> A tip can be used when you want to give advice -> related to a certain content. -{: .block-tip } -``` - -> ##### TIP -> -> A tip can be used when you want to give advice -> related to a certain content. -{: .block-tip } - -```markdown -> ##### WARNING -> -> This is a warning, and thus should -> be used when you want to warn the user -{: .block-warning } -``` - -> ##### WARNING -> -> This is a warning, and thus should -> be used when you want to warn the user -{: .block-warning } - -```markdown -> ##### DANGER -> -> This is a danger zone, and thus should -> be used carefully -{: .block-danger } -``` - -> ##### DANGER -> -> This is a danger zone, and thus should -> be used carefully -{: .block-danger } - - diff --git a/_posts/2023-07-04-jupyter-notebook.md b/_posts/2023-07-04-jupyter-notebook.md deleted file mode 100644 index 8c1a1fc..0000000 --- a/_posts/2023-07-04-jupyter-notebook.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -layout: post -title: a post with jupyter notebook -date: 2023-07-04 08:57:00-0400 -description: an example of a blog post with jupyter notebook -tags: formatting jupyter -categories: sample-posts -giscus_comments: true -related_posts: false ---- - -To include a jupyter notebook in a post, you can use the following code: - -{% raw %} - -```liquid -{::nomarkdown} -{% assign jupyter_path = 'assets/jupyter/blog.ipynb' | relative_url %} -{% capture notebook_exists %}{% file_exists assets/jupyter/blog.ipynb %}{% endcapture %} -{% if notebook_exists == 'true' %} - {% jupyter_notebook jupyter_path %} -{% else %} -

Sorry, the notebook you are looking for does not exist.

-{% endif %} -{:/nomarkdown} -``` - -{% endraw %} - -Let's break it down: this is possible thanks to [Jekyll Jupyter Notebook plugin](https://github.com/red-data-tools/jekyll-jupyter-notebook) that allows you to embed jupyter notebooks in your posts. It basically calls [`jupyter nbconvert --to html`](https://nbconvert.readthedocs.io/en/latest/usage.html#convert-html) to convert the notebook to an html page and then includes it in the post. Since [Kramdown](https://jekyllrb.com/docs/configuration/markdown/) is the default Markdown renderer for Jekyll, we need to surround the call to the plugin with the [::nomarkdown](https://kramdown.gettalong.org/syntax.html#extensions) tag so that it stops processing this part with Kramdown and outputs the content as-is. - -The plugin takes as input the path to the notebook, but it assumes the file exists. If you want to check if the file exists before calling the plugin, you can use the `file_exists` filter. This avoids getting a 404 error from the plugin and ending up displaying the main page inside of it instead. If the file does not exist, you can output a message to the user. The code displayed above outputs the following: - -{::nomarkdown} -{% assign jupyter_path = "assets/jupyter/blog.ipynb" | relative_url %} -{% capture notebook_exists %}{% file_exists assets/jupyter/blog.ipynb %}{% endcapture %} -{% if notebook_exists == "true" %} -{% jupyter_notebook jupyter_path %} -{% else %} - -

Sorry, the notebook you are looking for does not exist.

-{% endif %} -{:/nomarkdown} - -Note that the jupyter notebook supports both light and dark themes. diff --git a/_posts/2023-07-12-post-bibliography.md b/_posts/2023-07-12-post-bibliography.md deleted file mode 100644 index 168356c..0000000 --- a/_posts/2023-07-12-post-bibliography.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: post -title: a post with bibliography -date: 2023-07-12 09:56:00-0400 -description: an example of a blog post with bibliography -tags: formatting bib -categories: sample-posts -giscus_comments: true -related_posts: false -related_publications: true ---- - -This post shows how to add bibliography to simple blog posts. We support every citation style that [jekyll-scholar](https://github.com/inukshuk/jekyll-scholar) does. That means simple citation like {% cite einstein1950meaning %}, multiple citations like {% cite einstein1950meaning einstein1905movement %}, long references like {% reference einstein1905movement %} or also quotes: - -{% quote einstein1905electrodynamics %} -Lorem ipsum dolor sit amet, consectetur adipisicing elit, -sed do eiusmod tempor. - -Lorem ipsum dolor sit amet, consectetur adipisicing. -{% endquote %} - -If you would like something more academic, check the [distill style post]({% post_url 2018-12-22-distill %}). diff --git a/_posts/2023-12-12-tikzjax.md b/_posts/2023-12-12-tikzjax.md deleted file mode 100644 index a0df331..0000000 --- a/_posts/2023-12-12-tikzjax.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -layout: post -title: a post with TikZJax -date: 2023-12-12 22:25:00 -description: this is what included TikZ code could look like -tags: formatting diagrams -categories: sample-posts -tikzjax: true ---- - -This is an example post with TikZ code. TikZJax converts script tags (containing TikZ code) into SVGs. - - diff --git a/_posts/2024-01-26-chartjs.md b/_posts/2024-01-26-chartjs.md deleted file mode 100644 index 210557d..0000000 --- a/_posts/2024-01-26-chartjs.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -layout: post -title: a post with chart.js -date: 2024-01-26 01:04:00 -description: this is what included chart.js code could look like -tags: formatting charts -categories: sample-posts -chart: - chartjs: true ---- - -This is an example post with some [chart.js](https://www.chartjs.org/) code. - -````markdown -```chartjs -{ - "type": "line", - "data": { - "labels": [ - "January", - "February", - "March", - "April", - "May", - "June", - "July" - ], - "datasets": [ - { - "label": "# of bugs", - "fill": false, - "lineTension": 0.1, - "backgroundColor": "rgba(75,192,192,0.4)", - "borderColor": "rgba(75,192,192,1)", - "borderCapStyle": "butt", - "borderDash": [], - "borderDashOffset": 0, - "borderJoinStyle": "miter", - "pointBorderColor": "rgba(75,192,192,1)", - "pointBackgroundColor": "#fff", - "pointBorderWidth": 1, - "pointHoverRadius": 5, - "pointHoverBackgroundColor": "rgba(75,192,192,1)", - "pointHoverBorderColor": "rgba(220,220,220,1)", - "pointHoverBorderWidth": 2, - "pointRadius": 1, - "pointHitRadius": 10, - "data": [ - 65, - 59, - 80, - 81, - 56, - 55, - 40 - ], - "spanGaps": false - } - ] - }, - "options": {} -} -``` -```` - -This is how it looks like: - -```chartjs -{ - "type": "line", - "data": { - "labels": [ - "January", - "February", - "March", - "April", - "May", - "June", - "July" - ], - "datasets": [ - { - "label": "# of bugs", - "fill": false, - "lineTension": 0.1, - "backgroundColor": "rgba(75,192,192,0.4)", - "borderColor": "rgba(75,192,192,1)", - "borderCapStyle": "butt", - "borderDash": [], - "borderDashOffset": 0, - "borderJoinStyle": "miter", - "pointBorderColor": "rgba(75,192,192,1)", - "pointBackgroundColor": "#fff", - "pointBorderWidth": 1, - "pointHoverRadius": 5, - "pointHoverBackgroundColor": "rgba(75,192,192,1)", - "pointHoverBorderColor": "rgba(220,220,220,1)", - "pointHoverBorderWidth": 2, - "pointRadius": 1, - "pointHitRadius": 10, - "data": [ - 65, - 59, - 80, - 81, - 56, - 55, - 40 - ], - "spanGaps": false - } - ] - }, - "options": {} -} -``` - -Also another example chart. - -````markdown -```chartjs -{ - "type": "doughnut", - "data": { - "labels": [ - "Red", - "Blue", - "Yellow" - ], - "datasets": [ - { - "data": [ - 300, - 50, - 100 - ], - "backgroundColor": [ - "#FF6384", - "#36A2EB", - "#FFCE56" - ], - "hoverBackgroundColor": [ - "#FF6384", - "#36A2EB", - "#FFCE56" - ] - } - ] - }, - "options": {} -} -``` -```` - -Which generates: - -```chartjs -{ - "type": "doughnut", - "data": { - "labels": [ - "Red", - "Blue", - "Yellow" - ], - "datasets": [ - { - "data": [ - 300, - 50, - 100 - ], - "backgroundColor": [ - "#FF6384", - "#36A2EB", - "#FFCE56" - ], - "hoverBackgroundColor": [ - "#FF6384", - "#36A2EB", - "#FFCE56" - ] - } - ] - }, - "options": {} -} -``` diff --git a/_posts/2024-01-26-geojson-map.md b/_posts/2024-01-26-geojson-map.md deleted file mode 100644 index 6909aee..0000000 --- a/_posts/2024-01-26-geojson-map.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -layout: post -title: a post with geojson -date: 2024-01-26 17:57:00 -description: this is what included geojson code could look like -tags: formatting charts maps -categories: sample-posts -map: true ---- - -This is an example post with some [geojson](https://geojson.org/) code. The support is provided thanks to [Leaflet](https://leafletjs.com/). To create your own visualization, go to [geojson.io](https://geojson.io/). - -````markdown -```geojson -{ - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "properties": {}, - "geometry": { - "coordinates": [ - [ - [ - -60.11363029935569, - -2.904625022183211 - ], - [ - -60.11363029935569, - -3.162613728707967 - ], - [ - -59.820894493858034, - -3.162613728707967 - ], - [ - -59.820894493858034, - -2.904625022183211 - ], - [ - -60.11363029935569, - -2.904625022183211 - ] - ] - ], - "type": "Polygon" - } - } - ] -} -``` -```` - -Which generates: - -```geojson -{ - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "properties": {}, - "geometry": { - "coordinates": [ - [ - [ - -60.11363029935569, - -2.904625022183211 - ], - [ - -60.11363029935569, - -3.162613728707967 - ], - [ - -59.820894493858034, - -3.162613728707967 - ], - [ - -59.820894493858034, - -2.904625022183211 - ], - [ - -60.11363029935569, - -2.904625022183211 - ] - ] - ], - "type": "Polygon" - } - } - ] -} -``` diff --git a/_posts/2024-01-27-advanced-images.md b/_posts/2024-01-27-advanced-images.md deleted file mode 100644 index eb9beee..0000000 --- a/_posts/2024-01-27-advanced-images.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: post -title: a post with advanced image components -date: 2024-01-27 11:46:00 -description: this is what advanced image components could look like -tags: formatting images -categories: sample-posts -thumbnail: assets/img/9.jpg -images: - compare: true - slider: true ---- - -This is an example post with advanced image components. - -## Image Slider - -This is a simple image slider. It uses the [Swiper](https://swiperjs.com/) library. Check the [examples page](https://swiperjs.com/demos) for more information of what you can achieve with it. - - - {% include figure.liquid path="assets/img/9.jpg" class="img-fluid rounded z-depth-1" %} - {% include figure.liquid path="assets/img/7.jpg" class="img-fluid rounded z-depth-1" %} - {% include figure.liquid path="assets/img/8.jpg" class="img-fluid rounded z-depth-1" %} - {% include figure.liquid path="assets/img/10.jpg" class="img-fluid rounded z-depth-1" %} - {% include figure.liquid path="assets/img/12.jpg" class="img-fluid rounded z-depth-1" %} - - -## Image Comparison Slider - -This is a simple image comparison slider. It uses the [img-comparison-slider](https://img-comparison-slider.sneas.io/) library. Check the [examples page](https://img-comparison-slider.sneas.io/examples.html) for more information of what you can achieve with it. - - - {% include figure.liquid path="assets/img/prof_pic.jpg" class="img-fluid rounded z-depth-1" slot="first" %} - {% include figure.liquid path="assets/img/prof_pic_color.png" class="img-fluid rounded z-depth-1" slot="second" %} - diff --git a/_posts/2024-01-27-code-diff.md b/_posts/2024-01-27-code-diff.md deleted file mode 100644 index 6ec06d5..0000000 --- a/_posts/2024-01-27-code-diff.md +++ /dev/null @@ -1,473 +0,0 @@ ---- -layout: post -title: a post with code diff -date: 2024-01-27 19:22:00 -description: this is how you can display code diffs -tags: formatting code -categories: sample-posts -code_diff: true ---- - -You can display diff code by using the regular markdown syntax: - -````markdown -```diff -diff --git a/sample.js b/sample.js -index 0000001..0ddf2ba ---- a/sample.js -+++ b/sample.js -@@ -1 +1 @@ --console.log("Hello World!") -+console.log("Hello from Diff2Html!") -``` -```` - -Which generates: - -```diff -diff --git a/sample.js b/sample.js -index 0000001..0ddf2ba ---- a/sample.js -+++ b/sample.js -@@ -1 +1 @@ --console.log("Hello World!") -+console.log("Hello from Diff2Html!") -``` - -But this is difficult to read, specially if you have a large diff. You can use [diff2html](https://diff2html.xyz/) to display a more readable version of the diff. For this, just use `diff2html` instead of `diff` for the code block language: - -````markdown -```diff2html -diff --git a/sample.js b/sample.js -index 0000001..0ddf2ba ---- a/sample.js -+++ b/sample.js -@@ -1 +1 @@ --console.log("Hello World!") -+console.log("Hello from Diff2Html!") -``` -```` - -If we use a longer example, for example [this commit from diff2html](https://github.com/rtfpessoa/diff2html/commit/c2c253d3e3f8b8b267f551e659f72b44ca2ac927), it will generate the following output: - -```diff2html -From 2aaae31cc2a37bfff83430c2c914b140bee59b6a Mon Sep 17 00:00:00 2001 -From: Rodrigo Fernandes -Date: Sun, 9 Oct 2016 16:41:54 +0100 -Subject: [PATCH 1/2] Initial template override support - ---- - scripts/hulk.js | 4 ++-- - src/diff2html.js | 3 +-- - src/file-list-printer.js | 11 ++++++++--- - src/hoganjs-utils.js | 29 +++++++++++++++++------------ - src/html-printer.js | 6 ++++++ - src/line-by-line-printer.js | 6 +++++- - src/side-by-side-printer.js | 6 +++++- - test/file-list-printer-tests.js | 2 +- - test/hogan-cache-tests.js | 18 +++++++++++++++--- - test/line-by-line-tests.js | 3 +-- - test/side-by-side-printer-tests.js | 3 +-- - 11 files changed, 62 insertions(+), 29 deletions(-) - -diff --git a/scripts/hulk.js b/scripts/hulk.js -index 5a793c18..a4b1a4d5 100755 ---- a/scripts/hulk.js -+++ b/scripts/hulk.js -@@ -173,11 +173,11 @@ function namespace(name) { - // write a template foreach file that matches template extension - templates = extractFiles(options.argv.remain) - .map(function(file) { -- var openedFile = fs.readFileSync(file, 'utf-8'); -+ var openedFile = fs.readFileSync(file, 'utf-8').trim(); - var name; - if (!openedFile) return; - name = namespace(path.basename(file).replace(/\..*$/, '')); -- openedFile = removeByteOrderMark(openedFile.trim()); -+ openedFile = removeByteOrderMark(openedFile); - openedFile = wrap(file, name, openedFile); - if (!options.outputdir) return openedFile; - fs.writeFileSync(path.join(options.outputdir, name + '.js') -diff --git a/src/diff2html.js b/src/diff2html.js -index 21b0119e..64e138f5 100644 ---- a/src/diff2html.js -+++ b/src/diff2html.js -@@ -7,7 +7,6 @@ - - (function() { - var diffParser = require('./diff-parser.js').DiffParser; -- var fileLister = require('./file-list-printer.js').FileListPrinter; - var htmlPrinter = require('./html-printer.js').HtmlPrinter; - - function Diff2Html() { -@@ -43,7 +42,7 @@ - - var fileList = ''; - if (configOrEmpty.showFiles === true) { -- fileList = fileLister.generateFileList(diffJson, configOrEmpty); -+ fileList = htmlPrinter.generateFileListSummary(diffJson, configOrEmpty); - } - - var diffOutput = ''; -diff --git a/src/file-list-printer.js b/src/file-list-printer.js -index e408d9b2..1e0a2c61 100644 ---- a/src/file-list-printer.js -+++ b/src/file-list-printer.js -@@ -8,11 +8,16 @@ - (function() { - var printerUtils = require('./printer-utils.js').PrinterUtils; - -- var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils; -+ var hoganUtils; -+ - var baseTemplatesPath = 'file-summary'; - var iconsBaseTemplatesPath = 'icon'; - -- function FileListPrinter() { -+ function FileListPrinter(config) { -+ this.config = config; -+ -+ var HoganJsUtils = require('./hoganjs-utils.js').HoganJsUtils; -+ hoganUtils = new HoganJsUtils(config); - } - - FileListPrinter.prototype.generateFileList = function(diffFiles) { -@@ -38,5 +43,5 @@ - }); - }; - -- module.exports.FileListPrinter = new FileListPrinter(); -+ module.exports.FileListPrinter = FileListPrinter; - })(); -diff --git a/src/hoganjs-utils.js b/src/hoganjs-utils.js -index 9949e5fa..0dda08d7 100644 ---- a/src/hoganjs-utils.js -+++ b/src/hoganjs-utils.js -@@ -8,18 +8,19 @@ - (function() { - var fs = require('fs'); - var path = require('path'); -- - var hogan = require('hogan.js'); - - var hoganTemplates = require('./templates/diff2html-templates.js'); - -- var templatesPath = path.resolve(__dirname, 'templates'); -+ var extraTemplates; - -- function HoganJsUtils() { -+ function HoganJsUtils(configuration) { -+ this.config = configuration || {}; -+ extraTemplates = this.config.templates || {}; - } - -- HoganJsUtils.prototype.render = function(namespace, view, params, configuration) { -- var template = this.template(namespace, view, configuration); -+ HoganJsUtils.prototype.render = function(namespace, view, params) { -+ var template = this.template(namespace, view); - if (template) { - return template.render(params); - } -@@ -27,17 +28,16 @@ - return null; - }; - -- HoganJsUtils.prototype.template = function(namespace, view, configuration) { -- var config = configuration || {}; -+ HoganJsUtils.prototype.template = function(namespace, view) { - var templateKey = this._templateKey(namespace, view); - -- return this._getTemplate(templateKey, config); -+ return this._getTemplate(templateKey); - }; - -- HoganJsUtils.prototype._getTemplate = function(templateKey, config) { -+ HoganJsUtils.prototype._getTemplate = function(templateKey) { - var template; - -- if (!config.noCache) { -+ if (!this.config.noCache) { - template = this._readFromCache(templateKey); - } - -@@ -53,6 +53,7 @@ - - try { - if (fs.readFileSync) { -+ var templatesPath = path.resolve(__dirname, 'templates'); - var templatePath = path.join(templatesPath, templateKey); - var templateContent = fs.readFileSync(templatePath + '.mustache', 'utf8'); - template = hogan.compile(templateContent); -@@ -66,12 +67,16 @@ - }; - - HoganJsUtils.prototype._readFromCache = function(templateKey) { -- return hoganTemplates[templateKey]; -+ return extraTemplates[templateKey] || hoganTemplates[templateKey]; - }; - - HoganJsUtils.prototype._templateKey = function(namespace, view) { - return namespace + '-' + view; - }; - -- module.exports.HoganJsUtils = new HoganJsUtils(); -+ HoganJsUtils.prototype.compile = function(templateStr) { -+ return hogan.compile(templateStr); -+ }; -+ -+ module.exports.HoganJsUtils = HoganJsUtils; - })(); -diff --git a/src/html-printer.js b/src/html-printer.js -index 585d5b66..13f83047 100644 ---- a/src/html-printer.js -+++ b/src/html-printer.js -@@ -8,6 +8,7 @@ - (function() { - var LineByLinePrinter = require('./line-by-line-printer.js').LineByLinePrinter; - var SideBySidePrinter = require('./side-by-side-printer.js').SideBySidePrinter; -+ var FileListPrinter = require('./file-list-printer.js').FileListPrinter; - - function HtmlPrinter() { - } -@@ -22,5 +23,10 @@ - return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles); - }; - -+ HtmlPrinter.prototype.generateFileListSummary = function(diffJson, config) { -+ var fileListPrinter = new FileListPrinter(config); -+ return fileListPrinter.generateFileList(diffJson); -+ }; -+ - module.exports.HtmlPrinter = new HtmlPrinter(); - })(); -diff --git a/src/line-by-line-printer.js b/src/line-by-line-printer.js -index b07eb53c..d230bedd 100644 ---- a/src/line-by-line-printer.js -+++ b/src/line-by-line-printer.js -@@ -11,7 +11,8 @@ - var utils = require('./utils.js').Utils; - var Rematch = require('./rematch.js').Rematch; - -- var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils; -+ var hoganUtils; -+ - var genericTemplatesPath = 'generic'; - var baseTemplatesPath = 'line-by-line'; - var iconsBaseTemplatesPath = 'icon'; -@@ -19,6 +20,9 @@ - - function LineByLinePrinter(config) { - this.config = config; -+ -+ var HoganJsUtils = require('./hoganjs-utils.js').HoganJsUtils; -+ hoganUtils = new HoganJsUtils(config); - } - - LineByLinePrinter.prototype.makeFileDiffHtml = function(file, diffs) { -diff --git a/src/side-by-side-printer.js b/src/side-by-side-printer.js -index bbf1dc8d..5e3033b3 100644 ---- a/src/side-by-side-printer.js -+++ b/src/side-by-side-printer.js -@@ -11,7 +11,8 @@ - var utils = require('./utils.js').Utils; - var Rematch = require('./rematch.js').Rematch; - -- var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils; -+ var hoganUtils; -+ - var genericTemplatesPath = 'generic'; - var baseTemplatesPath = 'side-by-side'; - var iconsBaseTemplatesPath = 'icon'; -@@ -26,6 +27,9 @@ - - function SideBySidePrinter(config) { - this.config = config; -+ -+ var HoganJsUtils = require('./hoganjs-utils.js').HoganJsUtils; -+ hoganUtils = new HoganJsUtils(config); - } - - SideBySidePrinter.prototype.makeDiffHtml = function(file, diffs) { -diff --git a/test/file-list-printer-tests.js b/test/file-list-printer-tests.js -index a502a46f..60ea3208 100644 ---- a/test/file-list-printer-tests.js -+++ b/test/file-list-printer-tests.js -@@ -1,6 +1,6 @@ - var assert = require('assert'); - --var fileListPrinter = require('../src/file-list-printer.js').FileListPrinter; -+var fileListPrinter = new (require('../src/file-list-printer.js').FileListPrinter)(); - - describe('FileListPrinter', function() { - describe('generateFileList', function() { -diff --git a/test/hogan-cache-tests.js b/test/hogan-cache-tests.js -index 190bf6f8..3bb754ac 100644 ---- a/test/hogan-cache-tests.js -+++ b/test/hogan-cache-tests.js -@@ -1,6 +1,6 @@ - var assert = require('assert'); - --var HoganJsUtils = require('../src/hoganjs-utils.js').HoganJsUtils; -+var HoganJsUtils = new (require('../src/hoganjs-utils.js').HoganJsUtils)(); - var diffParser = require('../src/diff-parser.js').DiffParser; - - describe('HoganJsUtils', function() { -@@ -21,16 +21,28 @@ describe('HoganJsUtils', function() { - }); - assert.equal(emptyDiffHtml, result); - }); -+ - it('should render view without cache', function() { - var result = HoganJsUtils.render('generic', 'empty-diff', { - contentClass: 'd2h-code-line', - diffParser: diffParser - }, {noCache: true}); -- assert.equal(emptyDiffHtml + '\n', result); -+ assert.equal(emptyDiffHtml, result); - }); -+ - it('should return null if template is missing', function() { -- var result = HoganJsUtils.render('generic', 'missing-template', {}, {noCache: true}); -+ var hoganUtils = new (require('../src/hoganjs-utils.js').HoganJsUtils)({noCache: true}); -+ var result = hoganUtils.render('generic', 'missing-template', {}); - assert.equal(null, result); - }); -+ -+ it('should allow templates to be overridden', function() { -+ var emptyDiffTemplate = HoganJsUtils.compile('

{{myName}}

'); -+ -+ var config = {templates: {'generic-empty-diff': emptyDiffTemplate}}; -+ var hoganUtils = new (require('../src/hoganjs-utils.js').HoganJsUtils)(config); -+ var result = hoganUtils.render('generic', 'empty-diff', {myName: 'Rodrigo Fernandes'}); -+ assert.equal('

Rodrigo Fernandes

', result); -+ }); - }); - }); -diff --git a/test/line-by-line-tests.js b/test/line-by-line-tests.js -index 1cd92073..8869b3df 100644 ---- a/test/line-by-line-tests.js -+++ b/test/line-by-line-tests.js -@@ -14,7 +14,7 @@ describe('LineByLinePrinter', function() { - ' File without changes\n' + - ' \n' + - ' \n' + -- '\n'; -+ ''; - - assert.equal(expected, fileHtml); - }); -@@ -422,7 +422,6 @@ describe('LineByLinePrinter', function() { - ' \n' + - ' \n' + - '\n' + -- '\n' + - ' \n' + - ' \n' + - ' \n' + -diff --git a/test/side-by-side-printer-tests.js b/test/side-by-side-printer-tests.js -index 76625f8e..771daaa5 100644 ---- a/test/side-by-side-printer-tests.js -+++ b/test/side-by-side-printer-tests.js -@@ -14,7 +14,7 @@ describe('SideBySidePrinter', function() { - ' File without changes\n' + - ' \n' + - ' \n' + -- '\n'; -+ ''; - - assert.equal(expectedRight, fileHtml.right); - assert.equal(expectedLeft, fileHtml.left); -@@ -324,7 +324,6 @@ describe('SideBySidePrinter', function() { - ' \n' + - ' \n' + - '\n' + -- '\n' + - ' \n' + - ' \n' + - ' \n' + - -From f3cadb96677d0eb82fc2752dc3ffbf35ca9b5bdb Mon Sep 17 00:00:00 2001 -From: Rodrigo Fernandes -Date: Sat, 15 Oct 2016 13:21:22 +0100 -Subject: [PATCH 2/2] Allow uncompiled templates - ---- - README.md | 3 +++ - src/hoganjs-utils.js | 7 +++++++ - test/hogan-cache-tests.js | 24 +++++++++++++++++++++++- - 3 files changed, 33 insertions(+), 1 deletion(-) - -diff --git a/README.md b/README.md -index 132c8a28..46909f25 100644 ---- a/README.md -+++ b/README.md -@@ -98,6 +98,9 @@ The HTML output accepts a Javascript object with configuration. Possible options - - `synchronisedScroll`: scroll both panes in side-by-side mode: `true` or `false`, default is `false` - - `matchWordsThreshold`: similarity threshold for word matching, default is 0.25 - - `matchingMaxComparisons`: perform at most this much comparisons for line matching a block of changes, default is `2500` -+ - `templates`: object with previously compiled templates to replace parts of the html -+ - `rawTemplates`: object with raw not compiled templates to replace parts of the html -+ > For more information regarding the possible templates look into [src/templates](https://github.com/rtfpessoa/diff2html/tree/master/src/templates) - - ## Diff2HtmlUI Helper - -diff --git a/src/hoganjs-utils.js b/src/hoganjs-utils.js -index 0dda08d7..b2e9c275 100644 ---- a/src/hoganjs-utils.js -+++ b/src/hoganjs-utils.js -@@ -17,6 +17,13 @@ - function HoganJsUtils(configuration) { - this.config = configuration || {}; - extraTemplates = this.config.templates || {}; -+ -+ var rawTemplates = this.config.rawTemplates || {}; -+ for (var templateName in rawTemplates) { -+ if (rawTemplates.hasOwnProperty(templateName)) { -+ if (!extraTemplates[templateName]) extraTemplates[templateName] = this.compile(rawTemplates[templateName]); -+ } -+ } - } - - HoganJsUtils.prototype.render = function(namespace, view, params) { -diff --git a/test/hogan-cache-tests.js b/test/hogan-cache-tests.js -index 3bb754ac..a34839c0 100644 ---- a/test/hogan-cache-tests.js -+++ b/test/hogan-cache-tests.js -@@ -36,7 +36,7 @@ describe('HoganJsUtils', function() { - assert.equal(null, result); - }); - -- it('should allow templates to be overridden', function() { -+ it('should allow templates to be overridden with compiled templates', function() { - var emptyDiffTemplate = HoganJsUtils.compile('

{{myName}}

'); - - var config = {templates: {'generic-empty-diff': emptyDiffTemplate}}; -@@ -44,5 +44,27 @@ describe('HoganJsUtils', function() { - var result = hoganUtils.render('generic', 'empty-diff', {myName: 'Rodrigo Fernandes'}); - assert.equal('

Rodrigo Fernandes

', result); - }); -+ -+ it('should allow templates to be overridden with uncompiled templates', function() { -+ var emptyDiffTemplate = '

{{myName}}

'; -+ -+ var config = {rawTemplates: {'generic-empty-diff': emptyDiffTemplate}}; -+ var hoganUtils = new (require('../src/hoganjs-utils.js').HoganJsUtils)(config); -+ var result = hoganUtils.render('generic', 'empty-diff', {myName: 'Rodrigo Fernandes'}); -+ assert.equal('

Rodrigo Fernandes

', result); -+ }); -+ -+ it('should allow templates to be overridden giving priority to compiled templates', function() { -+ var emptyDiffTemplate = HoganJsUtils.compile('

{{myName}}

'); -+ var emptyDiffTemplateUncompiled = '

Not used!

'; -+ -+ var config = { -+ templates: {'generic-empty-diff': emptyDiffTemplate}, -+ rawTemplates: {'generic-empty-diff': emptyDiffTemplateUncompiled} -+ }; -+ var hoganUtils = new (require('../src/hoganjs-utils.js').HoganJsUtils)(config); -+ var result = hoganUtils.render('generic', 'empty-diff', {myName: 'Rodrigo Fernandes'}); -+ assert.equal('

Rodrigo Fernandes

', result); -+ }); - }); - }); -```