Content []byte
PageFmt string
DocumentID string
+ DocumentName string
Config *Blackfriday
RenderTOC bool
FileResolver FileResolverFunc
case "markdown":
return markdownRender(ctx)
case "asciidoc":
- return getAsciidocContent(ctx.Content)
+ return getAsciidocContent(ctx)
case "mmark":
return mmarkRender(ctx)
case "rst":
// getAsciidocContent calls asciidoctor or asciidoc as an external helper
// to convert AsciiDoc content to HTML.
-func getAsciidocContent(content []byte) []byte {
+func getAsciidocContent(ctx *RenderingContext) []byte {
+ content := ctx.Content
cleanContent := bytes.Replace(content, SummaryDivider, []byte(""), 1)
path := getAsciidocExecPath()
for _, item := range strings.Split(string(cmderr.Bytes()), "\n") {
item := strings.TrimSpace(item)
if item != "" {
- jww.ERROR.Println(item)
+ jww.ERROR.Println(strings.Replace(item, "<stdin>", ctx.DocumentName, 1))
}
}
if err != nil {
return helpers.RenderBytes(&helpers.RenderingContext{
Content: content, RenderTOC: true, PageFmt: p.determineMarkupType(),
ConfigProvider: p.Language(),
- DocumentID: p.UniqueID(), Config: p.getRenderingConfig(), LinkResolver: fn, FileResolver: fileFn})
+ DocumentID: p.UniqueID(), DocumentName: p.Path(),
+ Config: p.getRenderingConfig(), LinkResolver: fn, FileResolver: fileFn})
}
func (p *Page) getRenderingConfig() *helpers.Blackfriday {
newInner := helpers.RenderBytes(&helpers.RenderingContext{
Content: []byte(inner), PageFmt: p.determineMarkupType(),
ConfigProvider: p.Language(),
- DocumentID: p.UniqueID(), Config: p.getRenderingConfig()})
+ DocumentID: p.UniqueID(),
+ DocumentName: p.Path(),
+ Config: p.getRenderingConfig()})
// If the type is “unknown” or “markdown”, we assume the markdown
// generation has been performed. Given the input: `a line`, markdown