mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-12-05 00:00:34 +00:00
fix: Bug in high-level API for png formatter
This commit is contained in:
parent
3bf8172b89
commit
8b34a1659d
@ -1,16 +1,20 @@
|
|||||||
require "../formatter"
|
require "../formatter"
|
||||||
|
require "compress/gzip"
|
||||||
|
require "digest/sha1"
|
||||||
require "stumpy_png"
|
require "stumpy_png"
|
||||||
require "stumpy_utils"
|
require "stumpy_utils"
|
||||||
require "compress/gzip"
|
|
||||||
|
|
||||||
module Tartrazine
|
module Tartrazine
|
||||||
def self.to_png(text : String, language : String,
|
def self.to_png(text : String, language : String,
|
||||||
theme : String = "default-dark",
|
theme : String = "default-dark",
|
||||||
line_numbers : Bool = false) : String
|
line_numbers : Bool = false) : String
|
||||||
|
buf = IO::Memory.new
|
||||||
|
|
||||||
Tartrazine::Png.new(
|
Tartrazine::Png.new(
|
||||||
theme: Tartrazine.theme(theme),
|
theme: Tartrazine.theme(theme),
|
||||||
line_numbers: line_numbers
|
line_numbers: line_numbers
|
||||||
).format(text, Tartrazine.lexer(name: language))
|
).format(text, Tartrazine.lexer(name: language), buf)
|
||||||
|
buf.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
class FontFiles
|
class FontFiles
|
||||||
|
Loading…
Reference in New Issue
Block a user