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

Update HTML docs #217

Merged
merged 3 commits into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions assets/html/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ pre code {
background-color: initial;
}

/* Headers in admonitions and docstrings */
.admonition h1,
article section.docstring h1 {
font-size: 1.25em;
}

.admonition h2,
article section.docstring h2 {
font-size: 1.10em;
}

.admonition h3,
.admonition h4,
.admonition h5,
.admonition h6,
article section.docstring h3,
article section.docstring h4,
article section.docstring h5,
article section.docstring h6 {
font-size: 1em;
}

/* Navigation */
nav.toc {
/* TODO: would be nice to have the navigation fixed, but the simple
Expand Down
27 changes: 25 additions & 2 deletions docs/src/man/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,37 @@ user-readable format for distribution.
While in principle any Markdown parser would do (as long as it supports the required
Markdown extensions), the Python-based [MkDocs](http://www.mkdocs.org/) is usually used
to convert the Markdown files into a set of HTML pages.
See [Hosting Documentation](@ref) for further information on configuring `mkdocs` for Documenter.
See [Hosting Documentation](@ref) for further information on configuring MkDocs for Documenter.

!!! note "Native HTML output"
There is experimental support for native HTML output in Documenter.
It can be enabled by passing the `format = Documenter.Formats.HTML` option to
[`makedocs`](@ref). An example `make.jl` can be found under `test/html/`.
[`makedocs`](@ref). It also requires the `pages` and `sitename` options.
`make.jl` should then look something like
```julia
makedocs(
...,
format = Documenter.Formats.HTML,
sitename = "Package name",
pages = [
"page.md",
"Page title" => "page2.md",
"Subsection" => [
...
]
]
)
```
Since Documenter's docs are already built using HTML output, a fully working
example of the configuration can be found in `docs/make.jl`.

It is still under development, may contain bugs, and undergo changes.
However, any feedback is very welcome and early adopters are encouraged to try it out.
Issues and suggestions should be posted to
[Documenter.jl's issue tracker](https://github.com/JuliaDocs/Documenter.jl/issues).

# Additional `makedocs` options for HTML output
**`sitename`** is the site's title displayed in the title bar and at the top
of the navigation menu.

**`pages`** defines the hierarchy of the navigation menu.
13 changes: 11 additions & 2 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,15 @@ end
# mdconvert
# ------------------------------------------------------------------------------

md_block_nodes = [Markdown.MD, Markdown.BlockQuote, Markdown.List]
if isdefined(Base.Markdown, :Admonition) push!(md_block_nodes, Markdown.Admonition) end

"""
[`MDBlockContext`](@ref) is a union of all the Markdown nodes whose children should
be blocks. It can be used to dispatch on all the block-context nodes at once.
"""
typealias MDBlockContext Union{md_block_nodes...}

"""
Convert a markdown object to a `DOM.Node` object.

Expand All @@ -607,7 +616,7 @@ mdconvert(b::Markdown.BlockQuote, parent) = Tag(:blockquote)(mdconvert(b.content

mdconvert(b::Markdown.Bold, parent) = Tag(:strong)(mdconvert(b.text, parent))

function mdconvert(c::Markdown.Code, parent::Markdown.MD)
function mdconvert(c::Markdown.Code, parent::MDBlockContext)
@tags pre code
language = isempty(c.language) ? "none" : c.language
pre(code[".language-$(language)"](c.code))
Expand All @@ -622,7 +631,7 @@ mdconvert(i::Markdown.Image, parent) = Tag(:img)[:src => i.url, :alt => i.alt]

mdconvert(i::Markdown.Italic, parent) = Tag(:em)(mdconvert(i.text, i))

mdconvert(m::Markdown.LaTeX, ::Markdown.MD) = Tag(:div)(string("\\[", m.formula, "\\]"))
mdconvert(m::Markdown.LaTeX, ::MDBlockContext) = Tag(:div)(string("\\[", m.formula, "\\]"))
mdconvert(m::Markdown.LaTeX, parent) = Tag(:span)(string('$', m.formula, '$'))

mdconvert(::Markdown.LineBreak, parent) = Tag(:br)()
Expand Down