@ -553,8 +553,7 @@ function markdown(inputfile, outputdir=pwd(); config::AbstractDict=Dict(), kwarg
# create the markdown file
# create the markdown file
sb = sandbox ( )
sb = sandbox ( )
iomd = IOBuffer ( )
iomd = IOBuffer ( )
continued = false
for ( chunknum , chunk ) in enumerate ( chunks )
for chunk in chunks
if isa ( chunk , MDChunk )
if isa ( chunk , MDChunk )
for line in chunk . lines
for line in chunk . lines
write ( iomd , line . second , '\n' ) # skip indent here
write ( iomd , line . second , '\n' ) # skip indent here
@ -587,7 +586,9 @@ function markdown(inputfile, outputdir=pwd(); config::AbstractDict=Dict(), kwarg
inputfile = config [ " literate_inputfile " ] ,
inputfile = config [ " literate_inputfile " ] ,
fake_source = config [ " literate_outputfile " ] ,
fake_source = config [ " literate_outputfile " ] ,
flavor = config [ " flavor " ] ,
flavor = config [ " flavor " ] ,
image_formats = config [ " image_formats " ] )
image_formats = config [ " image_formats " ] ,
file_prefix = " $ ( config [ " name " ] ) - $ ( chunknum ) " ,
)
end
end
end
end
end
end
@ -604,7 +605,7 @@ end
function execute_markdown! ( io :: IO , sb :: Module , block :: String , outputdir ;
function execute_markdown! ( io :: IO , sb :: Module , block :: String , outputdir ;
inputfile :: String , fake_source :: String ,
inputfile :: String , fake_source :: String ,
flavor :: AbstractFlavor , image_formats :: Vector )
flavor :: AbstractFlavor , image_formats :: Vector , file_prefix :: String )
# TODO: Deal with explicit display(...) calls
# TODO: Deal with explicit display(...) calls
r , str , _ = execute_block ( sb , block ; inputfile = inputfile , fake_source = fake_source )
r , str , _ = execute_block ( sb , block ; inputfile = inputfile , fake_source = fake_source )
# issue #101: consecutive codefenced blocks need newline
# issue #101: consecutive codefenced blocks need newline
@ -621,7 +622,7 @@ function execute_markdown!(io::IO, sb::Module, block::String, outputdir;
end
end
for ( mime , ext ) in image_formats
for ( mime , ext ) in image_formats
if Base . invokelatest ( showable , mime , r )
if Base . invokelatest ( showable , mime , r )
file = string ( hash ( block ) % UInt32 ) * ext
file = file_prefix * ext
open ( joinpath ( outputdir , file ) , " w " ) do io
open ( joinpath ( outputdir , file ) , " w " ) do io
Base . invokelatest ( show , io , mime , r )
Base . invokelatest ( show , io , mime , r )
end
end