Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-text/plain output for Markdown and LaTeX #938

Merged
merged 1 commit into from
Feb 6, 2019
Merged

Conversation

fredrikekre
Copy link
Member

Fix non-text/plain output for Markdown
and LaTeX output by capturing several
output representations and let each writer
choose which one to render,
fixes #916, fixes fredrikekre/Literate.jl#49.

@mortenpi mortenpi added this to the 0.22.0 milestone Feb 5, 2019
@mortenpi
Copy link
Member

mortenpi commented Feb 5, 2019

Hmm, the images on the man/tutorial.md page in test/examples/ should be built via this, right? In the Markdown output I get things like this:

```julia
GIF(joinpath(dirname(pathof(Documenter)), "..", "test", "examples", "images", "logo.gif"))
```


```
Main.ex-inlinewebpgifjpeg.InlineWEBPGIFJPEG.GIF("/home/mortenpi/Julia/JuliaDocs/Documenter/src/../test/examples/images/logo.gif")
```

I suggest we put this in as an enhancement in 0.22 even though it might technically be eligible for a backport?

@fredrikekre
Copy link
Member Author

I suggest we put this in as an enhancement in 0.22

Definitely.

@fredrikekre
Copy link
Member Author

Hmm, the images on the man/tutorial.md page in test/examples/ should be built via this, right?

Yea I guess, I just didn't enable gif output for markdown files, but should be the same as e.g. png's I guess. It took the text/plain path here (which is still better than the current status which errors since the markdown writer can not handle RawHTML).

@mortenpi
Copy link
Member

mortenpi commented Feb 5, 2019

A few more thoughts:

  • It should not be a problem to also support WebP images in MarkdownWriter in the same way.
  • It should actually be fine to have arbitrary HTML in the outputted Markdown -- MkDocs should handle it without issues (Documenter outputs some anyway, e.g. the anchor tags). So the <img src="data:..."> approach should also work for MarkdownWriter too. It should also be possible to output text/html. Needs to be tested though.

To test the MkDocs build, docs_dir in test/examples/mkdocs.yml needs to be changed to builds/markdown.

@fredrikekre fredrikekre force-pushed the fe/multioutput branch 2 times, most recently from 465ca41 to 6ce3420 Compare February 5, 2019 23:47
and LaTeX output by capturing several
output representations and let each writer
choose which one to render,
fixes  #916, fixes fredrikekre/Literate.jl#49.

Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
@mortenpi mortenpi merged commit 7a4a4b5 into master Feb 6, 2019
@mortenpi mortenpi deleted the fe/multioutput branch February 6, 2019 19:23
\\includegraphics{$(filename)}
\\end{figure}
""")
elseif haskey(d, MIME"text/latex"())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it make sense to prefer text/latex in latex writer? I don't use latex writer myself so I don't know what's the optimal order, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it made sense to prioritize more rich formats, such as images, before latex 🤷‍♂️. I don't think it is very commong for things to be showable in both formats so probably doesn't matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output capturing for Markdown and LaTeX plot figure is not shown
3 participants