Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Language code tabs preprocessor for mdBook

NotificationsYou must be signed in to change notification settings

nx10/mdbook-langtabs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crates.ioLicense: MIT

AnmdBook preprocessor that creates language tabs for code examples.

Language tabs example demo

Also check out thelive demo.

Features

  • Switch between language examples without scrolling
  • Automatic language icons viaDevicon

Installation

cargo install mdbook-langtabs

Or install the current development version:

cargo install --git https://github.com/nx10/mdbook-langtabs

Setup

Either use the automatic installer:

mdbook-langtabs install /path/to/your/book

Or manually:

  1. Add to yourbook.toml:
[preprocessor.langtabs]command ="mdbook-langtabs"[output.html]additional-css = ["langtabs.css"]additional-js = ["langtabs.js"]
  1. Copylangtabs.css andlangtabs.js to your book's root directory.

Usage

Wrap your code blocks with the special comments:

<!-- langtabs-start-->```rustfnmain() {println!("Hello from Rust!");}``````pythondefmain():print("Hello from Python!")``````javascriptfunctionmain() {console.log("Hello from JavaScript!");}```<!-- langtabs-end-->

This creates tabbed code examples that readers can switch between, as shown in the demo above.

License

MIT

About

Language code tabs preprocessor for mdBook

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp