Giter Site home page Giter Site logo

fenced_code_tabs's Introduction

Fenced Code Tabs

This is a port of the original markdown fenced code tabs project for zola.

an illustration of the result

How to use it

{% fenced_code_tab(tabs=["rust", "C", "java"]) %}
```rust
prinln!("Hello World!");
```
---
```C
prinf("Hello World!\n");
```
---
```java
system.out.println("Hello World!");
```
{% end %}

This is the code we used to generate the previous picture.

{% fenced_code_tab(tabs=["rust", "C", "java"]) %}
...
...
...
{% end %}

This is how you call the shortcode, you need to specify the title of each tabs or it'll throw an error. Each code block needs to be separated by an empty line containing only ---. The number of codeblock needs to be equal to the number of tab titles.

How to include it in you project

You'll need to put the this file in your templates/shortcodes directory. You can read more about shortcodes here. You'll also need to include the css file in the scss directory. You can read more about css in zola here.


Once this is done you'll need to find a way to include the associated css in the pages where the shortcode is used. There is multiple way to do it:

If you are using your own theme you can add the following line to the head part of your index.html: <link rel="stylesheet" href="fenced_code_tab.css">


If you are using another theme and it supports rewriting the header create a file called templates/index.html containing these lines:

{% extends "sam/templates/index.html" %}
{% block head %}
	{{ super() }}
	<link rel="stylesheet" href="fenced_code_tab.css">
{% endblock head %}

If your theme does not supports this option and you don't want to patch it / fork it. Copy the file called themes/[theme_name]/templates/index.html from your theme to your own templates/index.html add this line to the header part of the file: <link rel="stylesheet" href="fenced_code_tab.css">

fenced_code_tabs's People

Contributors

irevoire avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.