Add syntax highlighting for examples

And also removed the redundant "language". I think for the ones reading this, it is obvious that these are (programming) languages… 😊
pull/31/head
rugk 7 years ago committed by GitHub
parent d0945942a9
commit 72e415add7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,8 +40,9 @@ More information about QR Code technology and this library's design can be found
Examples Examples
-------- --------
Java language: Java:
```java
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -60,9 +61,11 @@ Java language:
(... paint qr1.getModule(x, y) ...) (... paint qr1.getModule(x, y) ...)
} }
} }
```
JavaScript language: JavaScript:
```js
// Name abbreviated for the sake of these examples here // Name abbreviated for the sake of these examples here
var QRC = qrcodegen.QrCode; var QRC = qrcodegen.QrCode;
@ -78,9 +81,11 @@ JavaScript language:
(... paint qr1.getModule(x, y) ...) (... paint qr1.getModule(x, y) ...)
} }
} }
```
Python language: Python:
```python
from qrcodegen import * from qrcodegen import *
# Simple operation # Simple operation
@ -93,9 +98,11 @@ Python language:
for y in range(qr1.get_size()): for y in range(qr1.get_size()):
for x in range(qr1.get_size()): for x in range(qr1.get_size()):
(... paint qr1.get_module(x, y) ...) (... paint qr1.get_module(x, y) ...)
```
C++ language: C++ language:
```c++
#include <string> #include <string>
#include <vector> #include <vector>
#include "QrCode.hpp" #include "QrCode.hpp"
@ -115,9 +122,11 @@ C++ language:
(... paint qr1.getModule(x, y) ...) (... paint qr1.getModule(x, y) ...)
} }
} }
```
C language: C language:
```c
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "qrcodegen.h" #include "qrcodegen.h"
@ -145,9 +154,11 @@ C language:
uint8_t qr1[qrcodegen_BUFFER_LEN_FOR_VERSION(7)]; uint8_t qr1[qrcodegen_BUFFER_LEN_FOR_VERSION(7)];
ok = qrcodegen_encodeBinary(dataAndTemp, 3, qr1, ok = qrcodegen_encodeBinary(dataAndTemp, 3, qr1,
qrcodegen_Ecc_HIGH, 2, 7, qrcodegen_Mask_4, false); qrcodegen_Ecc_HIGH, 2, 7, qrcodegen_Mask_4, false);
```
Rust language: Rust:
```rust
extern crate qrcodegen; extern crate qrcodegen;
use qrcodegen::QrCode; use qrcodegen::QrCode;
use qrcodegen::QrCodeEcc; use qrcodegen::QrCodeEcc;
@ -168,7 +179,7 @@ Rust language:
(... paint qr1.get_module(x, y) ...) (... paint qr1.get_module(x, y) ...)
} }
} }
```
License License
------- -------

Loading…
Cancel
Save