├── assets ├── html │ ├── style.css │ ├── documenter.js │ ├── search.js │ └── documenter.css ├── mkdocs │ ├── Documenter.css │ └── mathjaxhelper.js └── latex │ └── documenter.sty ├── .codecov.yml ├── test ├── REQUIRE ├── examples │ ├── src │ │ ├── hidden │ │ │ ├── y.md │ │ │ ├── z.md │ │ │ ├── x.md │ │ │ └── index.md │ │ ├── man │ │ │ ├── data.csv │ │ │ └── tutorial.md │ │ ├── assets │ │ │ ├── custom.js │ │ │ ├── search.js │ │ │ └── custom.css │ │ ├── hidden.md │ │ ├── lib │ │ │ ├── crlf.md │ │ │ ├── autodocs.md │ │ │ └── functions.md │ │ └── index.md │ ├── pages │ │ ├── b.jl │ │ ├── c.jl │ │ ├── e.jl │ │ ├── a.jl │ │ └── d.jl │ ├── mkdocs.yml │ ├── make.jl │ └── tests.jl ├── missingdocs │ ├── src │ │ ├── none │ │ │ └── index.md │ │ └── exports │ │ │ └── index.md │ └── make.jl ├── errors │ ├── deploydocs.jl │ ├── make.jl │ └── src │ │ └── index.md ├── coverage.jl ├── runtests.jl ├── navnode.jl ├── formats │ ├── markdown.jl │ └── latex.jl ├── utilities.jl ├── mdflatten.jl ├── docsystem.jl └── dom.jl ├── docs ├── src │ ├── man │ │ ├── internals.md │ │ ├── examples.md │ │ ├── contributing.md │ │ ├── latex.md │ │ ├── doctests.md │ │ ├── hosting.md │ │ ├── guide.md │ │ └── syntax.md │ ├── assets │ │ └── logo.png │ ├── lib │ │ ├── internals │ │ │ ├── anchors.md │ │ │ ├── builder.md │ │ │ ├── dom.md │ │ │ ├── formats.md │ │ │ ├── walkers.md │ │ │ ├── docchecks.md │ │ │ ├── docsystem.md │ │ │ ├── documents.md │ │ │ ├── expanders.md │ │ │ ├── generator.md │ │ │ ├── selectors.md │ │ │ ├── utilities.md │ │ │ ├── mdflatten.md │ │ │ ├── cross-references.md │ │ │ └── writers.md │ │ ├── internals.md │ │ └── public.md │ └── index.md └── make.jl ├── REQUIRE ├── .gitignore ├── .travis.yml ├── appveyor.yml ├── src ├── Deps.jl ├── Formats.jl ├── Writers │ ├── Writers.jl │ └── MarkdownWriter.jl ├── Walkers.jl ├── Generator.jl ├── Utilities │ ├── MDFlatten.jl │ └── DOM.jl ├── Anchors.jl ├── Selectors.jl ├── Builder.jl ├── CrossReferences.jl ├── DocSystem.jl └── Documents.jl ├── LICENSE.md └── README.md /assets/html/style.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | -------------------------------------------------------------------------------- /test/REQUIRE: -------------------------------------------------------------------------------- 1 | BaseTestNext 2 | -------------------------------------------------------------------------------- /test/examples/src/hidden/y.md: -------------------------------------------------------------------------------- 1 | # Hidden 2 2 | -------------------------------------------------------------------------------- /test/examples/src/hidden/z.md: -------------------------------------------------------------------------------- 1 | # Hidden 3 2 | -------------------------------------------------------------------------------- /docs/src/man/internals.md: -------------------------------------------------------------------------------- 1 | # Package Internals 2 | 3 | -------------------------------------------------------------------------------- /test/examples/src/man/data.csv: -------------------------------------------------------------------------------- 1 | csv,data,file 2 | 1,2,3 3 | -------------------------------------------------------------------------------- /test/examples/src/assets/custom.js: -------------------------------------------------------------------------------- 1 | // custom javascript 2 | -------------------------------------------------------------------------------- /REQUIRE: -------------------------------------------------------------------------------- 1 | julia 0.4 2 | Compat 0.8 3 | DocStringExtensions 0.2 4 | -------------------------------------------------------------------------------- /test/examples/src/hidden.md: -------------------------------------------------------------------------------- 1 | # Hidden (toplevel) 2 | 3 | ## Section 4 | -------------------------------------------------------------------------------- /test/examples/src/assets/search.js: -------------------------------------------------------------------------------- 1 | // overrides Documenter's search.js 2 | -------------------------------------------------------------------------------- /test/missingdocs/src/none/index.md: -------------------------------------------------------------------------------- 1 | # MissingDocs None 2 | 3 | ```@docs 4 | ``` 5 | -------------------------------------------------------------------------------- /test/examples/src/hidden/x.md: -------------------------------------------------------------------------------- 1 | # Hidden 1 2 | 3 | ## First heading 4 | ## Second heading 5 | -------------------------------------------------------------------------------- /docs/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpsanders/Documenter.jl/master/docs/src/assets/logo.png -------------------------------------------------------------------------------- /docs/src/lib/internals/anchors.md: -------------------------------------------------------------------------------- 1 | # Anchors 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Anchors] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/builder.md: -------------------------------------------------------------------------------- 1 | # Builder 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Builder] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/dom.md: -------------------------------------------------------------------------------- 1 | # DOM 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Utilities.DOM] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/formats.md: -------------------------------------------------------------------------------- 1 | # Formats 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Formats] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/walkers.md: -------------------------------------------------------------------------------- 1 | # Walkers 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Walkers] 5 | ``` 6 | -------------------------------------------------------------------------------- /test/missingdocs/src/exports/index.md: -------------------------------------------------------------------------------- 1 | # MissingDocs Exports 2 | 3 | ```@docs 4 | Main.MissingDocs.f 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/docchecks.md: -------------------------------------------------------------------------------- 1 | # DocChecks 2 | 3 | ```@autodocs 4 | Modules = [Documenter.DocChecks] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/docsystem.md: -------------------------------------------------------------------------------- 1 | # DocSystem 2 | 3 | ```@autodocs 4 | Modules = [Documenter.DocSystem] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/documents.md: -------------------------------------------------------------------------------- 1 | # Documents 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Documents] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/expanders.md: -------------------------------------------------------------------------------- 1 | # Expanders 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Expanders] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/generator.md: -------------------------------------------------------------------------------- 1 | # Generator 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Generator] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/selectors.md: -------------------------------------------------------------------------------- 1 | # Selectors 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Selectors] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/utilities.md: -------------------------------------------------------------------------------- 1 | # Utilities 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Utilities] 5 | ``` 6 | -------------------------------------------------------------------------------- /test/examples/src/assets/custom.css: -------------------------------------------------------------------------------- 1 | /* custom.css */ 2 | 3 | center.raw-html-block { 4 | color: red; 5 | } 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/mdflatten.md: -------------------------------------------------------------------------------- 1 | # MDFlatten 2 | 3 | ```@autodocs 4 | Modules = [Documenter.Utilities.MDFlatten] 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/src/lib/internals/cross-references.md: -------------------------------------------------------------------------------- 1 | # CrossReferences 2 | 3 | ```@autodocs 4 | Modules = [Documenter.CrossReferences] 5 | ``` 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.jl.cov 2 | *.jl.*.cov 3 | *.jl.mem 4 | 5 | test/examples/builds/ 6 | test/missingdocs/build/ 7 | test/errors/build/ 8 | docs/build/ 9 | docs/site/ 10 | -------------------------------------------------------------------------------- /test/examples/src/lib/crlf.md: -------------------------------------------------------------------------------- 1 | !!! warning 2 | 3 | This file contains windows line endings. Do not edit. 4 | 5 | ```jldoctest 6 | a = 1 7 | b = 2 8 | a + b 9 | 10 | # output 11 | 12 | 3 13 | ``` 14 | -------------------------------------------------------------------------------- /test/errors/deploydocs.jl: -------------------------------------------------------------------------------- 1 | @test_throws ErrorException deploydocs( 2 | repo = "github.com/JuliaDocs/Documenter.jl.git", 3 | julia = 0.5, # must be a string 4 | target = "build", 5 | deps = nothing, 6 | make = nothing, 7 | ) 8 | -------------------------------------------------------------------------------- /docs/src/lib/internals/writers.md: -------------------------------------------------------------------------------- 1 | # Writers 2 | 3 | ```@autodocs 4 | Modules = [ 5 | Documenter.Writers, 6 | Documenter.Writers.MarkdownWriter, 7 | Documenter.Writers.HTMLWriter, 8 | Documenter.Writers.LaTeXWriter, 9 | ] 10 | ``` 11 | -------------------------------------------------------------------------------- /test/examples/src/hidden/index.md: -------------------------------------------------------------------------------- 1 | # Hidden pages 2 | 3 | Pages can be hidden with the [`hide`](@ref) function. 4 | 5 | ## List of hidden pages 6 | 7 | - [Hidden page 1](x.md) 8 | - [Hidden page 2](y.md) 9 | - [Hidden page 3](z.md) 10 | 11 | ## Docs for `hide` 12 | 13 | ```@docs 14 | hide 15 | ``` 16 | -------------------------------------------------------------------------------- /test/examples/pages/b.jl: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | `f` from page `b.jl`. 4 | 5 | Links: 6 | 7 | - [`ccall`](@ref) 8 | - [`while`](@ref) 9 | - [`@time`](@ref) 10 | - [`T`](@ref) 11 | - [`f`](@ref) 12 | - [`f(::Any)`](@ref) 13 | - [`f(::Any, ::Any)`](@ref) 14 | - [`f(::Any, ::Any, ::Any)`](@ref) 15 | 16 | """ 17 | f(x, y) = x + y 18 | -------------------------------------------------------------------------------- /test/examples/pages/c.jl: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | `f` from page `c.jl`. 4 | 5 | Links: 6 | 7 | - [`ccall`](@ref) 8 | - [`while`](@ref) 9 | - [`@time`](@ref) 10 | - [`T`](@ref) 11 | - [`f`](@ref) 12 | - [`f(::Any)`](@ref) 13 | - [`f(::Any, ::Any)`](@ref) 14 | - [`f(::Any, ::Any, ::Any)`](@ref) 15 | 16 | """ 17 | f(x, y, z) = x + y + z 18 | -------------------------------------------------------------------------------- /test/errors/make.jl: -------------------------------------------------------------------------------- 1 | module ErrorsModule 2 | 3 | """ 4 | ```jldoctest 5 | julia> a = 1 6 | 2 7 | 8 | ``` 9 | 10 | ```jldoctest 11 | ``` 12 | """ 13 | func(x) = x 14 | 15 | end 16 | 17 | using Documenter 18 | 19 | makedocs(modules = [ErrorsModule]) 20 | 21 | @test_throws ErrorException makedocs(modules = [ErrorsModule], strict = true) 22 | -------------------------------------------------------------------------------- /test/coverage.jl: -------------------------------------------------------------------------------- 1 | # Only run coverage from linux nightly build on travis. 2 | get(ENV, "TRAVIS_OS_NAME", "") == "linux" || exit() 3 | get(ENV, "TRAVIS_JULIA_VERSION", "") == "nightly" || exit() 4 | 5 | Pkg.add("Coverage") 6 | using Coverage 7 | 8 | cd(joinpath(dirname(@__FILE__), "..")) do 9 | Codecov.submit(Codecov.process_folder()) 10 | end 11 | -------------------------------------------------------------------------------- /test/examples/pages/e.jl: -------------------------------------------------------------------------------- 1 | module E 2 | 3 | export f_1, f_2, f_3 4 | 5 | "f_1" 6 | f_1(x) = x 7 | 8 | "f_2" 9 | f_2(x) = x 10 | 11 | "f_3" 12 | f_3(x) = x 13 | 14 | 15 | "g_1" 16 | g_1(x) = x 17 | 18 | "g_2" 19 | g_2(x) = x 20 | 21 | "g_3" 22 | g_3(x) = x 23 | 24 | export T_1 25 | 26 | "T_1" 27 | type T_1 end 28 | 29 | "T_2" 30 | type T_2 end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: julia 2 | 3 | os: 4 | - linux 5 | - osx 6 | 7 | julia: 8 | - 0.4 9 | - 0.5 10 | - nightly 11 | 12 | notifications: 13 | email: false 14 | 15 | # https://github.com/travis-ci/travis-ci/issues/4942 workaround 16 | git: 17 | depth: 99999 18 | 19 | after_success: 20 | - julia -e 'cd(Pkg.dir("Documenter", "test")); include("coverage.jl")' 21 | -------------------------------------------------------------------------------- /assets/mkdocs/Documenter.css: -------------------------------------------------------------------------------- 1 | div.wy-menu-vertical ul.current li.toctree-l3 a { 2 | font-weight: bold; 3 | } 4 | 5 | a.documenter-source { 6 | float: right; 7 | } 8 | 9 | .documenter-methodtable pre { 10 | margin-left: 0px; 11 | margin-right: 0px; 12 | margin-top: 0px; 13 | padding: 0px; 14 | } 15 | 16 | .documenter-methodtable pre.documenter-inline { 17 | display: inline; 18 | } 19 | -------------------------------------------------------------------------------- /test/examples/pages/a.jl: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | `f` from page `a.jl`. 4 | 5 | Links: 6 | 7 | - [`ccall`](@ref) 8 | - [`while`](@ref) 9 | - [`@time(x)`](@ref) 10 | - [`T(x)`](@ref) 11 | - [`T(x, y)`](@ref) 12 | - [`f(::Integer)`](@ref) 13 | - [`f(::Any)`](@ref) 14 | - [`f(::Any, ::Any)`](@ref) 15 | - [`f(x, y, z)`](@ref) 16 | 17 | [^footnote]: 18 | 19 | Footnote contents. [^footnote] 20 | 21 | """ 22 | f(x) = x 23 | -------------------------------------------------------------------------------- /docs/src/lib/internals.md: -------------------------------------------------------------------------------- 1 | # Internal Documentation 2 | 3 | This page lists all the documented internals of the `Documenter` module and submodules. 4 | 5 | ## Contents 6 | 7 | ```@contents 8 | Pages = [joinpath("internals", f) for f in readdir("internals")] 9 | ``` 10 | 11 | ## Index 12 | 13 | A list of all internal documentation sorted by module. 14 | 15 | ```@index 16 | Pages = [joinpath("internals", f) for f in readdir("internals")] 17 | ``` 18 | -------------------------------------------------------------------------------- /test/missingdocs/make.jl: -------------------------------------------------------------------------------- 1 | module MissingDocs 2 | export f 3 | 4 | "exported" 5 | f(x) = x 6 | 7 | "unexported" 8 | g(x) = x 9 | end 10 | 11 | using Documenter 12 | 13 | for sym in [:none, :exports] 14 | makedocs( 15 | root = dirname(@__FILE__), 16 | source = joinpath("src", string(sym)), 17 | build = joinpath("build", string(sym)), 18 | modules = MissingDocs, 19 | checkdocs = sym, 20 | format = :html, 21 | sitename = "MissingDocs Checks", 22 | ) 23 | end 24 | -------------------------------------------------------------------------------- /docs/src/lib/public.md: -------------------------------------------------------------------------------- 1 | # Public Documentation 2 | 3 | Documentation for `Documenter.jl`'s public interface. 4 | 5 | See [Internal Documentation](@ref) for internal package docs covering all submodules. 6 | 7 | ## Contents 8 | 9 | ```@contents 10 | Pages = ["public.md"] 11 | ``` 12 | 13 | ## Index 14 | 15 | ```@index 16 | Pages = ["public.md"] 17 | ``` 18 | 19 | ## Public Interface 20 | 21 | ```@docs 22 | Documenter 23 | makedocs 24 | hide 25 | deploydocs 26 | Documenter.generate 27 | Travis 28 | Travis.genkeys 29 | Deps 30 | Deps.pip 31 | ``` 32 | -------------------------------------------------------------------------------- /assets/mkdocs/mathjaxhelper.js: -------------------------------------------------------------------------------- 1 | MathJax.Hub.Config({ 2 | "tex2jax": { 3 | inlineMath: [['$','$'], ['\\(','\\)']], 4 | processEscapes: true 5 | } 6 | }); 7 | MathJax.Hub.Config({ 8 | config: ["MMLorHTML.js"], 9 | jax: [ 10 | "input/TeX", 11 | "output/HTML-CSS", 12 | "output/NativeMML" 13 | ], 14 | extensions: [ 15 | "MathMenu.js", 16 | "MathZoom.js", 17 | "TeX/AMSmath.js", 18 | "TeX/AMSsymbols.js", 19 | "TeX/autobold.js", 20 | "TeX/autoload-all.js" 21 | ] 22 | }); 23 | MathJax.Hub.Config({ 24 | TeX: { equationNumbers: { autoNumber: "AMS" } } 25 | }); 26 | -------------------------------------------------------------------------------- /test/examples/mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Documenter.jl 2 | repo_url: https://github.com/JuliaDocs/Documenter.jl 3 | site_description: Julia package documentation generator. 4 | site_author: Michael Hatherly 5 | 6 | theme: material 7 | 8 | extra: 9 | palette: 10 | primary: 'indigo' 11 | accent: 'blue' 12 | 13 | extra_css: 14 | - assets/Documenter.css 15 | 16 | markdown_extensions: 17 | - codehilite 18 | - extra 19 | - tables 20 | - fenced_code 21 | 22 | extra_javascript: 23 | - https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML 24 | - assets/mathjaxhelper.js 25 | 26 | docs_dir: 'build' 27 | 28 | pages: 29 | - Home: index.md 30 | - Manual: 31 | - Tutorial: man/tutorial.md 32 | - Library: 33 | - Functions: lib/functions.md 34 | - AutoDocs: lib/autodocs.md 35 | -------------------------------------------------------------------------------- /test/examples/pages/d.jl: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | `T` from page `d.jl`. 4 | 5 | Links: 6 | 7 | - [`ccall`](@ref) 8 | - [`while`](@ref) 9 | - [`@time`](@ref) 10 | - [`T`](@ref) 11 | - [`f`](@ref) 12 | - [`f(x)`](@ref) 13 | - [`f(x, y)`](@ref) 14 | - [`f(::Any, ::Any, ::Any)`](@ref) 15 | 16 | """ 17 | type T end 18 | 19 | 20 | """ 21 | `T` from page `d.jl`. 22 | 23 | Links: 24 | 25 | - [`ccall`](@ref) 26 | - [`while`](@ref) 27 | - [`@time`](@ref) 28 | - [`T(x)`](@ref) 29 | - [`T(x, y)`](@ref) 30 | - [`T(x, y, z)`](@ref) 31 | - [`f`](@ref) 32 | - [`f(x)`](@ref) 33 | - [`f(x, y)`](@ref) 34 | - [`f(::Any, ::Any, ::Any)`](@ref) 35 | 36 | """ 37 | T(x) = T() 38 | 39 | """ 40 | `T` from page `d.jl`. 41 | 42 | Links: 43 | 44 | - [`ccall`](@ref) 45 | - [`while`](@ref) 46 | - [`@time`](@ref) 47 | - [`T()`](@ref) 48 | - [`T(x)`](@ref) 49 | - [`T(x, y)`](@ref) 50 | - [`T(x, y, z)`](@ref) 51 | - [`f`](@ref) 52 | - [`f(x)`](@ref) 53 | - [`f(x, y)`](@ref) 54 | - [`f(::Any, ::Any, ::Any)`](@ref) 55 | 56 | """ 57 | T(x, y) = T() 58 | -------------------------------------------------------------------------------- /test/examples/src/lib/autodocs.md: -------------------------------------------------------------------------------- 1 | # `@autodocs` tests 2 | 3 | ```@meta 4 | CurrentModule = Main 5 | ``` 6 | 7 | ## Public 8 | 9 | Should include docs for 10 | 11 | * [`AutoDocs.Pages.E.f_1`](@ref) 12 | * [`AutoDocs.Pages.E.f_2`](@ref) 13 | * [`AutoDocs.Pages.E.f_3`](@ref) 14 | 15 | in that order. 16 | 17 | ```@autodocs 18 | Modules = [AutoDocs.Pages.E] 19 | Private = false 20 | Order = [:function] 21 | ``` 22 | 23 | ## Private 24 | 25 | Should include docs for 26 | 27 | * [`AutoDocs.Pages.E.g_1`](@ref) 28 | * [`AutoDocs.Pages.E.g_2`](@ref) 29 | * [`AutoDocs.Pages.E.g_3`](@ref) 30 | 31 | in that order. 32 | 33 | ```@autodocs 34 | Modules = [AutoDocs.Pages.E] 35 | Public = false 36 | Order = [:function] 37 | ``` 38 | 39 | ## Ordering of Public and Private 40 | 41 | Should include docs for 42 | 43 | * [`AutoDocs.Pages.E.T_1`](@ref) 44 | * [`AutoDocs.Pages.E.T_2`](@ref) 45 | 46 | in that order. 47 | 48 | ```@autodocs 49 | Modules = [AutoDocs.Pages.E] 50 | Order = [:type] 51 | ``` 52 | 53 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe" 4 | - JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe" 5 | - JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe" 6 | 7 | notifications: 8 | - provider: Email 9 | on_build_success: false 10 | on_build_failure: false 11 | on_build_status_changed: false 12 | 13 | install: 14 | # Download most recent Julia Windows binary 15 | - ps: (new-object net.webclient).DownloadFile( 16 | $("http://s3.amazonaws.com/"+$env:JULIAVERSION), 17 | "C:\projects\julia-binary.exe") 18 | # Run installer silently, output to C:\projects\julia 19 | - C:\projects\julia-binary.exe /S /D=C:\projects\julia 20 | 21 | build_script: 22 | # Need to convert from shallow to complete for Pkg.clone to work 23 | - IF EXIST .git\shallow (git fetch --unshallow) 24 | - C:\projects\julia\bin\julia -e "versioninfo(); 25 | Pkg.clone(pwd(), \"Documenter\"); Pkg.build(\"Documenter\")" 26 | 27 | test_script: 28 | - C:\projects\julia\bin\julia -e "Pkg.test(\"Documenter\")" 29 | -------------------------------------------------------------------------------- /src/Deps.jl: -------------------------------------------------------------------------------- 1 | """ 2 | Exported module that provides build and deploy dependencies and related functions. 3 | 4 | Currently only [`pip`](@ref) is implemented. 5 | """ 6 | module Deps 7 | 8 | export pip 9 | 10 | using DocStringExtensions 11 | 12 | """ 13 | $(SIGNATURES) 14 | 15 | Installs (as non-root user) all python packages listed in `deps`. 16 | 17 | # Examples 18 | 19 | ```julia 20 | using Documenter 21 | 22 | makedocs( 23 | # ... 24 | ) 25 | 26 | deploydocs( 27 | deps = Deps.pip("pygments", "mkdocs", "mkdocs-material"), 28 | # ... 29 | ) 30 | ``` 31 | """ 32 | pip(deps...) = () -> run(`pip install --user $(deps...)`) 33 | 34 | 35 | function localbin() 36 | is_linux() ? joinpath(homedir(), ".local", "bin") : 37 | is_apple() ? joinpath(homedir(), "Library", "Python", "2.7", "bin") : "" 38 | end 39 | 40 | function updatepath!(p = localbin()) 41 | if contains(ENV["PATH"], p) 42 | ENV["PATH"] 43 | else 44 | ENV["PATH"] = "$p:$(ENV["PATH"])" 45 | end 46 | end 47 | 48 | if isdefined(:OS_NAME) && !isdefined(:is_linux) && !isdefined(:is_apple) # compat 49 | is_linux() = OS_NAME === :Linux 50 | is_apple() = OS_NAME === :Apple || OS_NAME === :Darwin 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /test/errors/src/index.md: -------------------------------------------------------------------------------- 1 | 2 | ```@docs 3 | missing_doc 4 | ``` 5 | 6 | ```@docs 7 | parse error 8 | ``` 9 | 10 | ```@meta 11 | CurrentModule = NonExistantModule 12 | ``` 13 | 14 | ```@autodocs 15 | Modules = [NonExistantModule] 16 | ``` 17 | 18 | ```@eval 19 | NonExistantModule 20 | ``` 21 | 22 | ```@docs 23 | # comment in a @docs block 24 | ``` 25 | 26 | [`foo(x::Foo)`](@ref) creates an [`UndefVarError`](@ref) when `eval`d 27 | for the type signature, since `Foo` is not defined. 28 | 29 | Numeric literals don't have bindings: [`1`](@ref). Nor [`"strings"`](@ref). 30 | [`:symbols`] do, however. 31 | 32 | Some syntax errors in references will fail with an `ParseError`: [`foo+*bar`](@ref). 33 | Others, like [`foo(x`](@ref) will give an `:incomplete` expression. 34 | 35 | This is the footnote [^1]. And [^another] [^another]. 36 | 37 | [^1]: one 38 | 39 | [^nested]: a nested footnote 40 | 41 | [^another_one]: 42 | 43 | Things! [^1]. [^2]. 44 | 45 | [^nested] 46 | 47 | [^nested]: 48 | 49 | Duplicate [^1] nested footnote. 50 | 51 | ```@docs 52 | ErrorsModule.func 53 | ``` 54 | 55 | ```jldoctest 56 | julia> b = 1 57 | 2 58 | 59 | julia> x 60 | 61 | julia> x 62 | ERROR: UndefVarError: x not defined 63 | 64 | julia> x 65 | ``` 66 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The Documenter.jl package is licensed under the MIT "Expat" License: 2 | 3 | > Copyright (c) 2016: Michael Hatherly. 4 | > 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in all 13 | > copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | > SOFTWARE. 22 | > 23 | -------------------------------------------------------------------------------- /src/Formats.jl: -------------------------------------------------------------------------------- 1 | """ 2 | Filetypes used to decide which rendering methods in [`Documenter.Writers`](@ref) are called. 3 | 4 | The only supported format is currently `Markdown`. 5 | """ 6 | module Formats 7 | 8 | import ..Documenter 9 | 10 | using Compat, DocStringExtensions 11 | 12 | """ 13 | Represents the output format. Possible values are `Markdown`, `LaTeX`, and `HTML`. 14 | """ 15 | @enum( 16 | Format, 17 | Markdown, 18 | LaTeX, 19 | HTML, 20 | ) 21 | 22 | """ 23 | $(SIGNATURES) 24 | 25 | Converts a [`Format`](@ref) value to a `MIME` type. 26 | """ 27 | function mimetype(f::Symbol) 28 | f ≡ :markdown ? MIME"text/plain"() : 29 | f ≡ :latex ? MIME"text/latex"() : 30 | f ≡ :html ? MIME"text/html"() : 31 | error("unexpected format.") 32 | end 33 | 34 | function extension(f::Symbol, file) 35 | path, _ = splitext(file) 36 | string(path, extension(f)) 37 | end 38 | 39 | function extension(f::Symbol) 40 | f ≡ :markdown ? ".md" : 41 | f ≡ :latex ? ".tex" : 42 | f ≡ :html ? ".html" : 43 | error("unexpected format.") 44 | end 45 | 46 | # `fmt` -- convert a format spec to a vector of symbols. 47 | const DEPRECATION_MAPPING = Dict( 48 | Markdown => :markdown, 49 | LaTeX => :latex, 50 | HTML => :html, 51 | ) 52 | function _fmt(f::Format) 53 | local s = DEPRECATION_MAPPING[f] 54 | Base.depwarn("`$(f)` is deprecated use `:$(s)` for `format = ...`.", :fmt) 55 | return s 56 | end 57 | fmt(f::Format) = [_fmt(f)] 58 | fmt(v::Vector{Format}) = map(_fmt, v) 59 | fmt(s::Symbol) = [s] 60 | fmt(v::Vector{Symbol}) = v 61 | 62 | end 63 | -------------------------------------------------------------------------------- /assets/latex/documenter.sty: -------------------------------------------------------------------------------- 1 | % font settings 2 | \usepackage{fontspec, newunicodechar, polyglossia} 3 | 4 | \setsansfont{Lato}[Scale=MatchLowercase, Ligatures=TeX] 5 | \setmonofont{Fantasque Sans Mono}[Scale=MatchLowercase] 6 | \renewcommand{\familydefault}{\sfdefault} 7 | % 8 | 9 | % colours 10 | \usepackage{xcolor} 11 | 12 | \definecolor{light-blue}{HTML}{6b85dd} 13 | \definecolor{dark-blue}{HTML}{4266d5} 14 | \definecolor{light-red}{HTML}{d66661} 15 | \definecolor{dark-red}{HTML}{c93d39} 16 | \definecolor{light-green}{HTML}{6bab5b} 17 | \definecolor{dark-green}{HTML}{3b972e} 18 | \definecolor{light-purple}{HTML}{aa7dc0} 19 | \definecolor{dark-purple}{HTML}{945bb0} 20 | % 21 | 22 | % maths 23 | \usepackage{amsmath, amssymb} 24 | % 25 | 26 | % listings 27 | \usepackage{listings, minted} 28 | 29 | \lstset{ 30 | basicstyle = \small\ttfamily, 31 | breaklines = true, 32 | columns = fullflexible, 33 | frame = leftline, 34 | keepspaces = true, 35 | showstringspaces = false, 36 | xleftmargin = 3pt, 37 | } 38 | 39 | \setminted{ 40 | breaklines = true, 41 | fontsize = \small, 42 | frame = leftline, 43 | } 44 | % 45 | 46 | % tables 47 | \usepackage{tabulary} 48 | % 49 | 50 | % hyperref 51 | \usepackage{hyperref} 52 | \hypersetup{ 53 | pdfpagelabels, 54 | bookmarks, 55 | hyperindex, 56 | unicode = true, 57 | linkcolor = dark-blue, 58 | urlcolor = dark-purple, 59 | colorlinks = true, 60 | } 61 | % 62 | 63 | % table of contents 64 | \maxtocdepth{subsection} 65 | % 66 | 67 | % paragraphs 68 | \setlength{\parindent}{0pt} 69 | \nonzeroparskip 70 | % 71 | 72 | % adjust margins 73 | \setulmarginsandblock{1.5in}{1in}{*} 74 | \setlrmarginsandblock{1.5in}{1in}{*} 75 | \setheaderspaces{1in}{*}{*} 76 | \checkandfixthelayout 77 | % 78 | -------------------------------------------------------------------------------- /docs/make.jl: -------------------------------------------------------------------------------- 1 | using Documenter 2 | 3 | makedocs( 4 | modules = [Documenter], 5 | clean = false, 6 | format = :html, 7 | sitename = "Documenter.jl", 8 | authors = "Michael Hatherly, Morten Piibeleht, and contributors.", 9 | linkcheck = !("skiplinks" in ARGS), 10 | pages = Any[ # Compat: `Any` for 0.4 compat 11 | "Home" => "index.md", 12 | "Manual" => Any[ 13 | "Guide" => "man/guide.md", 14 | "man/examples.md", 15 | "man/syntax.md", 16 | "man/doctests.md", 17 | "man/hosting.md", 18 | "man/latex.md", 19 | "man/internals.md", 20 | "man/contributing.md", 21 | ], 22 | "Library" => Any[ 23 | "Public" => "lib/public.md", 24 | hide("Internals" => "lib/internals.md", Any[ 25 | "lib/internals/anchors.md", 26 | "lib/internals/builder.md", 27 | "lib/internals/cross-references.md", 28 | "lib/internals/docchecks.md", 29 | "lib/internals/docsystem.md", 30 | "lib/internals/documents.md", 31 | "lib/internals/dom.md", 32 | "lib/internals/expanders.md", 33 | "lib/internals/formats.md", 34 | "lib/internals/generator.md", 35 | "lib/internals/mdflatten.md", 36 | "lib/internals/selectors.md", 37 | "lib/internals/utilities.md", 38 | "lib/internals/walkers.md", 39 | "lib/internals/writers.md", 40 | ]) 41 | ] 42 | ] 43 | ) 44 | 45 | deploydocs( 46 | repo = "github.com/JuliaDocs/Documenter.jl.git", 47 | target = "build", 48 | deps = nothing, 49 | make = nothing, 50 | ) 51 | -------------------------------------------------------------------------------- /test/runtests.jl: -------------------------------------------------------------------------------- 1 | # Build the real docs first. 2 | include("../docs/make.jl") 3 | 4 | # Build the example docs 5 | include("examples/make.jl") 6 | 7 | # Test missing docs 8 | include("missingdocs/make.jl") 9 | 10 | # Primary @testset 11 | 12 | if VERSION >= v"0.5.0-dev+7720" 13 | using Base.Test 14 | else 15 | using BaseTestNext 16 | const Test = BaseTestNext 17 | end 18 | 19 | # Error reporting. 20 | println("="^50) 21 | info("The following errors are expected output.") 22 | include(joinpath("errors", "make.jl")) 23 | info("END of expected error output.") 24 | println("="^50) 25 | 26 | @testset "Documenter" begin 27 | # Unit tests for module internals. 28 | include("utilities.jl") 29 | 30 | # NavNode tests. 31 | include("navnode.jl") 32 | 33 | # DocSystem unit tests. 34 | include("docsystem.jl") 35 | 36 | # DOM Tests. 37 | include("dom.jl") 38 | 39 | # MDFlatten tests. 40 | include("mdflatten.jl") 41 | 42 | # Mock package docs. 43 | include("examples/tests.jl") 44 | 45 | # Documenter package docs with other formats. 46 | include("formats/markdown.jl") 47 | include("formats/latex.jl") 48 | 49 | # Deployment 50 | include("errors/deploydocs.jl") 51 | end 52 | 53 | # Additional tests 54 | 55 | ## `Markdown.MD` to `DOM.Node` conversion tests. 56 | module MarkdownToNode 57 | import Documenter.DocSystem 58 | import Documenter.Writers.HTMLWriter: mdconvert 59 | 60 | # Exhaustive Conversion from Markdown to Nodes. 61 | for mod in Base.Docs.modules 62 | for (binding, multidoc) in DocSystem.getmeta(mod) 63 | for (typesig, docstr) in multidoc.docs 64 | md = DocSystem.parsedoc(docstr) 65 | string(mdconvert(md)) 66 | end 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /docs/src/index.md: -------------------------------------------------------------------------------- 1 | # Documenter.jl 2 | 3 | *A documentation generator for Julia.* 4 | 5 | A package for building documentation from docstrings and markdown files. 6 | 7 | !!! note 8 | 9 | Please read through the 10 | [Documentation](http://docs.julialang.org/en/latest/manual/documentation/) section 11 | of the main Julia manual if this is your first time using Julia's documentation system. 12 | Once you've read through how to write documentation for your code then come back here. 13 | 14 | ## Package Features 15 | 16 | - Write all your documentation in [Markdown](https://en.wikipedia.org/wiki/Markdown). 17 | - Minimal configuration. 18 | - Supports Julia `0.4` and `0.5-dev`. 19 | - Doctests Julia code blocks. 20 | - Cross references for docs and section headers. 21 | - [``\LaTeX`` syntax](@ref latex_syntax) support. 22 | - Checks for missing docstrings and incorrect cross references. 23 | - Generates tables of contents and docstring indexes. 24 | - Use `git push` to automatically build and deploy docs from Travis to GitHub Pages. 25 | 26 | The [Package Guide](@ref) provides a tutorial explaining how to get started using Documenter. 27 | 28 | Some examples of packages using Documenter can be found on the [Examples](@ref) page. 29 | 30 | See the [Index](@ref main-index) for the complete list of documented functions and types. 31 | 32 | ## Manual Outline 33 | 34 | ```@contents 35 | Pages = [ 36 | "man/guide.md", 37 | "man/examples.md", 38 | "man/syntax.md", 39 | "man/doctests.md", 40 | "man/hosting.md", 41 | "man/latex.md", 42 | "man/contributing.md", 43 | ] 44 | Depth = 1 45 | ``` 46 | 47 | ## Library Outline 48 | 49 | ```@contents 50 | Pages = ["lib/public.md", "lib/internals.md"] 51 | ``` 52 | 53 | ### [Index](@id main-index) 54 | 55 | ```@index 56 | Pages = ["lib/public.md"] 57 | ``` 58 | -------------------------------------------------------------------------------- /test/navnode.jl: -------------------------------------------------------------------------------- 1 | module NavNodeTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | using Compat 11 | import Documenter: Documents, Builder 12 | import Documenter.Documents: NavNode 13 | 14 | type FakeDocumentInternal 15 | pages :: Dict{Compat.String, Void} 16 | navlist :: Vector{NavNode} 17 | FakeDocumentInternal() = new(Dict(), []) 18 | end 19 | type FakeDocument 20 | internal :: FakeDocumentInternal 21 | FakeDocument() = new(FakeDocumentInternal()) 22 | end 23 | 24 | @testset "NavNode" begin 25 | @test fieldtype(FakeDocumentInternal, :navlist) == fieldtype(Documents.Internal, :navlist) 26 | 27 | pages = [ 28 | "page1.md", 29 | "Page2" => "page2.md", 30 | "Section" => [ 31 | "page3.md", 32 | "Page4" => "page4.md", 33 | "Subsection" => [ 34 | "page5.md", 35 | ], 36 | ], 37 | "page6.md", 38 | ] 39 | doc = FakeDocument() 40 | doc.internal.pages = Dict(map(i -> "page$i.md" => nothing, 1:8)) 41 | navtree = Builder.walk_navpages(pages, nothing, doc) 42 | navlist = doc.internal.navlist 43 | 44 | @test length(navlist) == 6 45 | for (i,navnode) in enumerate(navlist) 46 | @test get(navnode.page) == "page$i.md" 47 | end 48 | 49 | @test isa(navtree, Vector{NavNode}) 50 | @test length(navtree) == 4 51 | @test navtree[1] === navlist[1] 52 | @test navtree[2] === navlist[2] 53 | @test navtree[4] === navlist[6] 54 | 55 | section = navtree[3] 56 | @test get(section.title_override) == "Section" 57 | @test isnull(section.page) 58 | @test length(section.children) == 3 59 | 60 | navpath = Documents.navpath(navlist[5]) 61 | @test length(navpath) == 3 62 | @test navpath[1] === section 63 | @test navpath[3] === navlist[5] 64 | end 65 | 66 | end 67 | -------------------------------------------------------------------------------- /test/formats/markdown.jl: -------------------------------------------------------------------------------- 1 | module MarkdownFormatTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | using Documenter 11 | 12 | # Documenter package docs 13 | info("Building Documenter's docs with Markdown.") 14 | const Documenter_root = normpath(joinpath(dirname(@__FILE__), "..", "..", "docs")) 15 | doc = makedocs( 16 | debug = true, 17 | root = Documenter_root, 18 | modules = Documenter, 19 | clean = false, 20 | ) 21 | 22 | @testset "Markdown" begin 23 | @test isa(doc, Documenter.Documents.Document) 24 | 25 | let build_dir = joinpath(Documenter_root, "build"), 26 | source_dir = joinpath(Documenter_root, "src") 27 | 28 | @test isdir(build_dir) 29 | @test isdir(joinpath(build_dir, "assets")) 30 | @test isdir(joinpath(build_dir, "lib")) 31 | @test isdir(joinpath(build_dir, "man")) 32 | 33 | @test isfile(joinpath(build_dir, "index.md")) 34 | @test isfile(joinpath(build_dir, "assets", "mathjaxhelper.js")) 35 | @test isfile(joinpath(build_dir, "assets", "Documenter.css")) 36 | end 37 | 38 | @test doc.user.root == Documenter_root 39 | @test doc.user.source == "src" 40 | @test doc.user.build == "build" 41 | @test doc.user.clean == false 42 | 43 | rm(joinpath(Documenter_root, "build"); recursive = true) 44 | 45 | mktempdir() do root 46 | let path = joinpath(root, "docs") 47 | Documenter.generate("DocumenterTestPackage", dir = path) 48 | @test isdir(path) 49 | @test isfile(joinpath(path, "mkdocs.yml")) 50 | @test isfile(joinpath(path, ".gitignore")) 51 | @test isfile(joinpath(path, "make.jl")) 52 | @test isdir(joinpath(path, "src")) 53 | @test isfile(joinpath(path, "src", "index.md")) 54 | end 55 | end 56 | 57 | @test_throws ErrorException Documenter.generate("Documenter") 58 | @test_throws ErrorException Documenter.generate(randstring()) 59 | end 60 | 61 | end 62 | -------------------------------------------------------------------------------- /test/formats/latex.jl: -------------------------------------------------------------------------------- 1 | module LaTeXFormatTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | using Documenter 11 | 12 | # Documenter package docs 13 | info("Building Documenter's docs with LaTeX.") 14 | const Documenter_root = normpath(joinpath(dirname(@__FILE__), "..", "..", "docs")) 15 | doc = makedocs( 16 | debug = true, 17 | root = Documenter_root, 18 | modules = [Documenter], 19 | clean = false, 20 | format = :latex, 21 | sitename = "Documenter.jl", 22 | authors = "Michael Hatherly, Morten Piibeleht, and contributors.", 23 | pages = Any[ # Compat: `Any` for 0.4 compat 24 | "Home" => "index.md", 25 | "Manual" => Any[ 26 | "Guide" => "man/guide.md", 27 | "man/examples.md", 28 | "man/syntax.md", 29 | "man/doctests.md", 30 | "man/hosting.md", 31 | "man/latex.md", 32 | "man/internals.md", 33 | "man/contributing.md", 34 | ], 35 | "Library" => Any[ 36 | "Public" => "lib/public.md", 37 | "Internals" => Any[ 38 | "Internals" => "lib/internals.md", 39 | "lib/internals/anchors.md", 40 | "lib/internals/builder.md", 41 | "lib/internals/cross-references.md", 42 | "lib/internals/docchecks.md", 43 | "lib/internals/docsystem.md", 44 | "lib/internals/documents.md", 45 | "lib/internals/dom.md", 46 | "lib/internals/expanders.md", 47 | "lib/internals/formats.md", 48 | "lib/internals/generator.md", 49 | "lib/internals/mdflatten.md", 50 | "lib/internals/selectors.md", 51 | "lib/internals/utilities.md", 52 | "lib/internals/walkers.md", 53 | "lib/internals/writers.md", 54 | ] 55 | ] 56 | ] 57 | ) 58 | 59 | @testset "LaTeX" begin 60 | @test isa(doc, Documenter.Documents.Document) 61 | end 62 | 63 | end 64 | -------------------------------------------------------------------------------- /assets/html/documenter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Part of Documenter.jl 3 | * https://github.com/JuliaDocs/Documenter.jl 4 | * 5 | * License: MIT 6 | */ 7 | 8 | requirejs.config({ 9 | paths: { 10 | 'jquery': 'https://code.jquery.com/jquery-3.1.0.js?', 11 | 'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min', 12 | 'mathjax': 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML', 13 | 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min', 14 | 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/languages/julia.min', 15 | }, 16 | shim: { 17 | 'mathjax' : { 18 | exports: "MathJax" 19 | }, 20 | 'highlight-julia': ['highlight'] 21 | } 22 | }); 23 | 24 | // Load MathJax 25 | require(['mathjax'], function(MathJax) { 26 | MathJax.Hub.Config({ 27 | "tex2jax": { 28 | inlineMath: [['$','$'], ['\\(','\\)']], 29 | processEscapes: true 30 | } 31 | }); 32 | MathJax.Hub.Config({ 33 | config: ["MMLorHTML.js"], 34 | jax: [ 35 | "input/TeX", 36 | "output/HTML-CSS", 37 | "output/NativeMML" 38 | ], 39 | extensions: [ 40 | "MathMenu.js", 41 | "MathZoom.js", 42 | "TeX/AMSmath.js", 43 | "TeX/AMSsymbols.js", 44 | "TeX/autobold.js", 45 | "TeX/autoload-all.js" 46 | ] 47 | }); 48 | MathJax.Hub.Config({ 49 | TeX: { equationNumbers: { autoNumber: "AMS" } } 50 | }); 51 | }) 52 | 53 | require(['jquery', 'highlight', 'highlight-julia'], function($, hljs) { 54 | $(document).ready(function() { 55 | if (typeof DOC_VERSIONS !== 'undefined') { 56 | var version_selector = $("#version-selector"); 57 | DOC_VERSIONS.forEach(function(each) { 58 | var option = $(""); 59 | version_selector.append(option); 60 | }); 61 | } 62 | hljs.initHighlighting(); 63 | }) 64 | 65 | }) 66 | -------------------------------------------------------------------------------- /test/utilities.jl: -------------------------------------------------------------------------------- 1 | module UtilitiesTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | import Documenter 11 | 12 | module UnitTests 13 | module SubModule end 14 | 15 | # Does `submodules` collect *all* the submodules? 16 | module A 17 | module B 18 | module C 19 | module D end 20 | end 21 | end 22 | end 23 | 24 | type T end 25 | 26 | "Documenter unit tests." 27 | Base.length(::T) = 1 28 | end 29 | 30 | @testset "Utilities" begin 31 | let doc = @doc(length) 32 | a = Documenter.Utilities.filterdocs(doc, Set{Module}()) 33 | b = Documenter.Utilities.filterdocs(doc, Set{Module}([UnitTests])) 34 | c = Documenter.Utilities.filterdocs(doc, Set{Module}([Base])) 35 | d = Documenter.Utilities.filterdocs(doc, Set{Module}([UtilitiesTests])) 36 | 37 | @test !isnull(a) 38 | @test get(a) === doc 39 | @test !isnull(b) 40 | @test contains(stringmime("text/plain", get(b)), "Documenter unit tests.") 41 | @test !isnull(c) 42 | @test !contains(stringmime("text/plain", get(c)), "Documenter unit tests.") 43 | @test isnull(d) 44 | end 45 | 46 | # Documenter.Utilities.issubmodule 47 | @test Documenter.Utilities.issubmodule(Main, Main) === true 48 | @test Documenter.Utilities.issubmodule(UnitTests, UnitTests) === true 49 | @test Documenter.Utilities.issubmodule(UnitTests.SubModule, Main) === true 50 | @test Documenter.Utilities.issubmodule(UnitTests.SubModule, UnitTests) === true 51 | @test Documenter.Utilities.issubmodule(UnitTests.SubModule, Base) === false 52 | @test Documenter.Utilities.issubmodule(UnitTests, UnitTests.SubModule) === false 53 | 54 | @test UnitTests.A in Documenter.Utilities.submodules(UnitTests.A) 55 | @test UnitTests.A.B in Documenter.Utilities.submodules(UnitTests.A) 56 | @test UnitTests.A.B.C in Documenter.Utilities.submodules(UnitTests.A) 57 | @test UnitTests.A.B.C.D in Documenter.Utilities.submodules(UnitTests.A) 58 | end 59 | 60 | end 61 | -------------------------------------------------------------------------------- /test/examples/src/index.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | ## Index Page 4 | 5 | ```@contents 6 | Pages = ["index.md"] 7 | Depth = 5 8 | ``` 9 | 10 | ## Functions Contents 11 | 12 | ```@contents 13 | Pages = ["lib/functions.md"] 14 | Depth = 3 15 | ``` 16 | 17 | ## Tutorial Contents 18 | 19 | ```@contents 20 | Pages = ["man/tutorial.md"] 21 | ``` 22 | 23 | ## Index 24 | 25 | ```@index 26 | ``` 27 | 28 | ### Embedded `@ref` links headers: [`ccall`](@ref) 29 | 30 | [#60](@ref) [#61](@ref) 31 | 32 | ```@repl 33 | zeros(5, 5) 34 | zeros(50, 50) 35 | ``` 36 | 37 | ```@meta 38 | DocTestSetup = quote 39 | using Base 40 | x = -3:0.01:3 41 | y = -4:0.02:5 42 | z = [Float64((xi^2 + yi^2)) for xi in x, yi in y] 43 | end 44 | ``` 45 | 46 | ```jldoctest 47 | julia> [1.0, 2.0, 3.0] 48 | 3-element Array{Float64,1}: 49 | 1.0 50 | 2.0 51 | 3.0 52 | 53 | ``` 54 | 55 | ```jldoctest 56 | julia> println(" "^5) 57 | 58 | julia> "\nfoo\n\nbar\n\n\nbaz" 59 | "\nfoo\n\nbar\n\n\nbaz" 60 | 61 | julia> println(ans) 62 | 63 | foo 64 | 65 | bar 66 | 67 | 68 | baz 69 | ``` 70 | 71 | ```jldoctest 72 | julia> info("...") 73 | INFO: ... 74 | 75 | ``` 76 | 77 | * `one` two three 78 | * four `five` six 79 | 80 | * ``` 81 | one 82 | ``` 83 | 84 | ## Raw Blocks 85 | 86 | ```@raw html 87 |
88 | CENTER 89 |
90 | ``` 91 | 92 | ```@raw latex 93 | \begin{verbatim} 94 | ``` 95 | 96 | ```@raw latex 97 | \end{verbatim} 98 | ``` 99 | 100 | # Symbols in doctests 101 | 102 | ```jldoctest 103 | julia> a = :undefined 104 | :undefined 105 | 106 | julia> a 107 | :undefined 108 | ``` 109 | 110 | # Named doctests 111 | 112 | ```jldoctest test-one 113 | julia> a = 1 114 | 1 115 | ``` 116 | 117 | ```jldoctest test-one 118 | julia> a + 1 119 | 2 120 | ``` 121 | 122 | # Sanitise module names 123 | 124 | ```jldoctest 125 | julia> type T end 126 | 127 | julia> t = T() 128 | T() 129 | 130 | julia> fullname(current_module()) 131 | () 132 | 133 | julia> fullname(Base.Pkg) 134 | (:Base,:Pkg) 135 | 136 | julia> current_module() 137 | Main 138 | ``` 139 | -------------------------------------------------------------------------------- /docs/src/man/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Sometimes the best way to learn how to use a new package is to look for 4 | examples of what others have already built with it. 5 | 6 | The following packages use Documenter to build their documentation and so 7 | should give a good overview of what this package is currently able to do. 8 | 9 | !!! note 10 | 11 | Packages are listed alphabetically. If you have a package that uses Documenter then 12 | please open a PR that adds it to the appropriate list below. 13 | 14 | The `make.jl` file for all listed packages will be tested to check for potential 15 | regressions prior to tagging new Documenter releases whenever possible. 16 | 17 | ## Registered 18 | 19 | Packages that have tagged versions available in `METADATA.jl`. 20 | 21 | - [BeaData.jl](https://stephenbnicar.github.io/BeaData.jl/latest/) 22 | - [ControlSystems.jl](http://juliacontrol.github.io/ControlSystems.jl/latest/) 23 | - [Currencies.jl](https://juliafinance.github.io/Currencies.jl/latest/) 24 | - [DifferentialEquations.jl](http://juliadiffeq.github.io/DiffEqDocs.jl/latest/) 25 | - [Documenter.jl](https://juliadocs.github.io/Documenter.jl/latest) 26 | - [ExtractMacro.jl](https://carlobaldassi.github.io/ExtractMacro.jl/latest) 27 | - [EzXML.jl](https://bicycle1885.github.io/EzXML.jl/latest/) 28 | - [Highlights.jl](https://juliadocs.github.io/Highlights.jl/latest/) 29 | - [Luxor.jl](https://cormullion.github.io/Luxor.jl) 30 | - [MergedMethods.jl](https://michaelhatherly.github.io/MergedMethods.jl/latest) 31 | - [Mimi.jl](http://anthofflab.berkeley.edu/Mimi.jl/stable/) 32 | - [NumericSuffixes.jl](https://michaelhatherly.github.io/NumericSuffixes.jl/latest) 33 | - [Optim.jl](https://juliaopt.github.io/Optim.jl/latest) 34 | - [POMDPs.jl](http://juliapomdp.github.io/POMDPs.jl/latest/) 35 | - [PhyloNetworks.jl](http://crsl4.github.io/PhyloNetworks.jl/latest/) 36 | - [PrivateModules.jl](https://michaelhatherly.github.io/PrivateModules.jl/latest) 37 | - [Query.jl](http://www.david-anthoff.com/Query.jl/stable/) 38 | - [TaylorSeries.jl](http://www.juliadiff.org/TaylorSeries.jl/latest/) 39 | - [Weave.jl](https://mpastell.github.io/Weave.jl/stable) 40 | 41 | ## Unregistered 42 | 43 | Packages that are not available in `METADATA.jl` and may be works-in-progress. 44 | Please do take that into consideration when browsing this list. 45 | 46 | - [AnonymousTypes.jl](https://michaelhatherly.github.io/AnonymousTypes.jl/latest) 47 | - [OhMyREPL.jl](https://github.com/KristofferC/OhMyREPL.jl) 48 | -------------------------------------------------------------------------------- /src/Writers/Writers.jl: -------------------------------------------------------------------------------- 1 | """ 2 | A module that provides several renderers for `Document` objects. The supported 3 | formats are currently: 4 | 5 | * `:markdown` -- the default format. 6 | * `:html` -- generates a complete HTML site with navigation and search included. 7 | * `:latex` -- generates a PDF using LuaLaTeX. 8 | 9 | """ 10 | module Writers 11 | 12 | import ..Documenter: 13 | Anchors, 14 | Builder, 15 | Documents, 16 | Expanders, 17 | Formats, 18 | Selectors, 19 | Documenter, 20 | Utilities 21 | 22 | using Compat 23 | 24 | # 25 | # Format selector definitions. 26 | # 27 | 28 | abstract FormatSelector <: Selectors.AbstractSelector 29 | 30 | abstract MarkdownFormat <: FormatSelector 31 | abstract LaTeXFormat <: FormatSelector 32 | abstract HTMLFormat <: FormatSelector 33 | 34 | Selectors.order(::Type{MarkdownFormat}) = 1.0 35 | Selectors.order(::Type{LaTeXFormat}) = 2.0 36 | Selectors.order(::Type{HTMLFormat}) = 3.0 37 | 38 | Selectors.matcher(::Type{MarkdownFormat}, fmt, _) = fmt === :markdown 39 | Selectors.matcher(::Type{LaTeXFormat}, fmt, _) = fmt === :latex 40 | Selectors.matcher(::Type{HTMLFormat}, fmt, _) = fmt === :html 41 | 42 | Selectors.runner(::Type{MarkdownFormat}, _, doc) = MarkdownWriter.render(doc) 43 | Selectors.runner(::Type{LaTeXFormat}, _, doc) = LaTeXWriter.render(doc) 44 | Selectors.runner(::Type{HTMLFormat}, _, doc) = HTMLWriter.render(doc) 45 | 46 | """ 47 | Writes a [`Documents.Document`](@ref) object to `.user.build` directory in 48 | the formats specified in the `.user.format` vector. 49 | 50 | Adding additional formats requires adding new `Selector` definitions as follows: 51 | 52 | ```julia 53 | abstract CustomFormat <: FormatSelector 54 | 55 | Selectors.order(::Type{CustomFormat}) = 4.0 # or a higher number. 56 | Selectors.matcher(::Type{CustomFormat}, fmt, _) = fmt === :custom 57 | Selectors.runner(::Type{CustomFormat}, _, doc) = CustomWriter.render(doc) 58 | 59 | # Definition of `CustomWriter` module below... 60 | ``` 61 | """ 62 | function render(doc::Documents.Document) 63 | # Render each format. Additional formats must define an `order`, `matcher`, `runner`, as 64 | # well as their own rendering methods in a separate module. 65 | for each in doc.user.format 66 | Selectors.dispatch(FormatSelector, each, doc) 67 | end 68 | # Revert all local links to their original URLs. 69 | for (link, url) in doc.internal.locallinks 70 | link.url = url 71 | end 72 | end 73 | 74 | include("MarkdownWriter.jl") 75 | include("HTMLWriter.jl") 76 | include("LaTeXWriter.jl") 77 | 78 | end 79 | -------------------------------------------------------------------------------- /src/Walkers.jl: -------------------------------------------------------------------------------- 1 | """ 2 | Provides the [`walk`](@ref) function. 3 | """ 4 | module Walkers 5 | 6 | import ..Documenter: 7 | Anchors, 8 | Builder, 9 | Documents, 10 | Expanders, 11 | Formats, 12 | Utilities 13 | 14 | using Compat, DocStringExtensions 15 | 16 | """ 17 | $(SIGNATURES) 18 | 19 | Calls `f` on `element` and any of its child elements. `meta` is a `Dict` containing metadata 20 | such as current module. 21 | """ 22 | walk(f, meta, element) = (f(element); nothing) 23 | 24 | # Change to the docstring's defining module if it has one. Change back afterwards. 25 | function walk(f, meta, block::Markdown.MD) 26 | tmp = get(meta, :CurrentModule, nothing) 27 | mod = get(block.meta, :module, nothing) 28 | mod ≡ nothing || (meta[:CurrentModule] = mod) 29 | f(block) && walk(f, meta, block.content) 30 | tmp ≡ nothing ? delete!(meta, :CurrentModule) : (meta[:CurrentModule] = tmp) 31 | nothing 32 | end 33 | 34 | function walk(f, meta, block::Vector) 35 | for each in block 36 | walk(f, meta, each) 37 | end 38 | end 39 | 40 | typealias MDContentElements Union{ 41 | Markdown.BlockQuote, 42 | Markdown.Paragraph, 43 | Markdown.MD, 44 | } 45 | walk(f, meta, block::MDContentElements) = f(block) ? walk(f, meta, block.content) : nothing 46 | 47 | walk(f, meta, block::Anchors.Anchor) = walk(f, meta, block.object) 48 | 49 | walk(f, meta, block::Expanders.DocsNodes) = walk(f, meta, block.nodes) 50 | walk(f, meta, block::Expanders.DocsNode) = walk(f, meta, block.docstr) 51 | 52 | walk(f, meta, block::Expanders.EvalNode) = walk(f, meta, block.result) 53 | 54 | walk(f, meta, block::Documents.RawHTML) = nothing 55 | 56 | walk(f, meta, block::Expanders.MetaNode) = (merge!(meta, block.dict); nothing) 57 | 58 | typealias MDTextElements Union{ 59 | Markdown.Bold, 60 | Markdown.Header, 61 | Markdown.Italic, 62 | } 63 | walk(f, meta, block::MDTextElements) = f(block) ? walk(f, meta, block.text) : nothing 64 | 65 | if isdefined(Base.Markdown, :Footnote) 66 | walk(f, meta, block::Markdown.Footnote) = f(block) ? walk(f, meta, block.text) : nothing 67 | end 68 | 69 | if isdefined(Base.Markdown, :Admonition) 70 | walk(f, meta, block::Markdown.Admonition) = f(block) ? walk(f, meta, block.content) : nothing 71 | end 72 | 73 | walk(f, meta, block::Markdown.Image) = f(block) ? walk(f, meta, block.alt) : nothing 74 | walk(f, meta, block::Markdown.Table) = f(block) ? walk(f, meta, block.rows) : nothing 75 | walk(f, meta, block::Markdown.List) = f(block) ? walk(f, meta, block.items) : nothing 76 | walk(f, meta, block::Markdown.Link) = f(block) ? walk(f, meta, block.text) : nothing 77 | 78 | end 79 | -------------------------------------------------------------------------------- /test/examples/src/man/tutorial.md: -------------------------------------------------------------------------------- 1 | # Tutorial 2 | 3 | [Documentation](@ref) 4 | 5 | [Index](@ref) 6 | 7 | [Functions](@ref) 8 | 9 | [`Main.Mod.func(x)`](@ref) 10 | 11 | [`Main.Mod.T`](@ref) 12 | 13 | ```jldoctest 14 | julia> using Base.Meta # `nothing` shouldn't be displayed. 15 | 16 | julia> Meta 17 | Base.Meta 18 | 19 | julia> a = 1 20 | 1 21 | 22 | julia> b = 2; 23 | 24 | julia> a + b 25 | 3 26 | ``` 27 | 28 | ```jldoctest 29 | a = 1 30 | b = 2 31 | a + b 32 | 33 | # output 34 | 35 | 3 36 | ``` 37 | 38 | ```@meta 39 | DocTestSetup = 40 | quote 41 | srand(1) 42 | end 43 | ``` 44 | 45 | ```jldoctest 46 | a = 1 47 | b = 2 48 | a / b 49 | 50 | # output 51 | 52 | 0.5 53 | ``` 54 | 55 | ```jldoctest 56 | julia> a = 1; 57 | 58 | julia> b = 2 59 | 2 60 | 61 | julia> a / b 62 | 0.5 63 | ``` 64 | 65 | ```@eval 66 | code = string(sprint(Base.banner), "julia>") 67 | Markdown.Code(code) 68 | ``` 69 | 70 | ```jldoctest 71 | julia> # First definition. 72 | function f(x, y) 73 | x + y 74 | end 75 | # 76 | # Second definition. 77 | # 78 | type T 79 | x 80 | end 81 | 82 | julia> isdefined(:f), isdefined(:T) # Check for both definitions. 83 | (true,true) 84 | 85 | julia> import Base 86 | 87 | julia> using Base.Meta 88 | 89 | julia> r = isexpr(:(using Base.Meta), :using); # Discarded result. 90 | 91 | julia> !r 92 | false 93 | ``` 94 | 95 | ```jldoctest 96 | julia> for i = 1:5 97 | println(i) 98 | end 99 | 1 100 | 2 101 | 3 102 | 4 103 | 5 104 | 105 | julia> println("Printing with semi-comma ending."); 106 | Printing with semi-comma ending. 107 | 108 | julia> warn("..."); 109 | WARNING: ... 110 | 111 | julia> div(1, 0) 112 | ERROR: DivideError: integer division error 113 | [...] 114 | 115 | julia> info("...") # ... 116 | println("a"); # Semi-colons *not* on the last expression shouldn't suppress output. 117 | println(1) # ... 118 | 2 # ... 119 | INFO: ... 120 | a 121 | 1 122 | 2 123 | 124 | julia> info("...") # ... 125 | println("a"); # Semi-colons *not* on the last expression shouldn't suppress output. 126 | println(1) # ... 127 | 2; # Only those in the last expression. 128 | INFO: ... 129 | a 130 | 1 131 | 132 | ``` 133 | 134 | ```jldoctest 135 | a = 1 136 | b = 2; # Semi-colons don't affect script doctests. 137 | 138 | # output 139 | 140 | 2 141 | ``` 142 | 143 | ```@repl 1 144 | f(x) = (sleep(x); x) 145 | @time f(0.1); 146 | ``` 147 | 148 | ```@repl 1 149 | f(0.01) 150 | div(1, 0) 151 | ``` 152 | 153 | ```@eval 154 | 1 + 2 155 | nothing 156 | ``` 157 | -------------------------------------------------------------------------------- /test/examples/src/lib/functions.md: -------------------------------------------------------------------------------- 1 | 2 | ```@meta 3 | CurrentModule = Main.Mod 4 | ``` 5 | 6 | # Function Index 7 | 8 | ```@index 9 | Pages = ["lib/functions.md"] 10 | ``` 11 | 12 | # Functions 13 | 14 | [`ccall`](@ref), [`func(x)`](@ref), [`T`](@ref), [`for`](@ref), and [`while`](@ref). 15 | 16 | ```@docs 17 | func(x) 18 | T 19 | ccall 20 | for 21 | while 22 | @time 23 | @assert 24 | ``` 25 | 26 | # Foo 27 | 28 | ```@example 29 | @show pwd() 30 | a = 1 31 | ``` 32 | 33 | ... 34 | 35 | ```@example 36 | isdefined(:a) 37 | ``` 38 | 39 | ```@example 1 40 | f(x) = 2x 41 | g(x) = 3x 42 | nothing # hide 43 | ``` 44 | 45 | ```@example 2 46 | x, y = 1, 2 47 | println(x, y) 48 | ``` 49 | 50 | ```@example 3 51 | type T end 52 | t = T() 53 | ``` 54 | 55 | ## Foo 56 | 57 | ```@example 3 58 | isdefined(:T) 59 | @show isdefined(:t) # hide 60 | @show typeof(T) 61 | typeof(t) # hide 62 | ``` 63 | 64 | ```@example 2 65 | x + y 66 | ``` 67 | 68 | ```@example 1 69 | f(2), g(2) 70 | ``` 71 | 72 | ### Foo 73 | 74 | ```@example 2 75 | x - y 76 | ``` 77 | 78 | ```@example 1 79 | f(1), g(1) 80 | ``` 81 | 82 | ```@example 3 83 | @which T() 84 | ``` 85 | 86 | #### Foo 87 | 88 | ```@example 89 | a = 1 90 | b = ans 91 | @assert a === b 92 | ``` 93 | 94 | ```@repl 95 | srand(1); # hide 96 | nothing 97 | rand() 98 | a = 1 99 | println(a) 100 | b = 2 101 | a + b 102 | type T 103 | x :: Int 104 | y :: Vector 105 | end 106 | x = T(1, [1]) 107 | x.y 108 | x.x 109 | ``` 110 | 111 | ```@repl 1 112 | d = 1 113 | ``` 114 | 115 | ```@repl 1 116 | println(d) 117 | ``` 118 | 119 | Test setup function 120 | 121 | ```@setup testsetup 122 | w = 5 123 | ``` 124 | 125 | ```@example testsetup 126 | @assert w === 5 127 | ``` 128 | 129 | ```@repl testsetup 130 | @assert w === 5 131 | ``` 132 | 133 | # Autodocs 134 | 135 | ```@meta 136 | CurrentModule = Main 137 | ``` 138 | 139 | ## AutoDocs Module 140 | 141 | ```@autodocs 142 | Modules = [AutoDocs] 143 | ``` 144 | 145 | ## Functions, Modules, and Macros 146 | 147 | ```@autodocs 148 | Modules = [AutoDocs.A, AutoDocs.B] 149 | Order = [:function, :module, :macro] 150 | ``` 151 | 152 | ## Constants and Types 153 | 154 | ```@autodocs 155 | Modules = [AutoDocs.A, AutoDocs.B] 156 | Order = [:constant, :type] 157 | ``` 158 | 159 | ## Autodocs by Page 160 | 161 | ```@autodocs 162 | Modules = [AutoDocs.Pages] 163 | Pages = ["a.jl", "b.jl"] 164 | ``` 165 | 166 | ```@autodocs 167 | Modules = [AutoDocs.Pages] 168 | Pages = ["c.jl", "d.jl"] 169 | ``` 170 | 171 | A footnote reference [^footnote]. 172 | 173 | # Named docstring `@ref`s 174 | 175 | * a normal docstring `@ref` link: [`AutoDocs.Pages.f`](@ref); 176 | * a named docstring `@ref` link: [`f`](@ref AutoDocs.Pages.f); 177 | * and a link with custom text: [`@time 1 + 2`](@ref @time); 178 | * some invalid syntax: [`for i = 1:10; ...`](@ref for). 179 | -------------------------------------------------------------------------------- /test/mdflatten.jl: -------------------------------------------------------------------------------- 1 | module MDFlattenTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | using Base.Markdown 11 | using Documenter.Utilities.MDFlatten 12 | 13 | @testset "MDFlatten" begin 14 | @test mdflatten(Markdown.Paragraph("...")) == "..." 15 | @test mdflatten(Markdown.Header{1}("...")) == "..." 16 | 17 | # a simple test for blocks in top-level (each gets two newline appended to it) 18 | @test mdflatten(Markdown.parse("# Test\nTest")) == "Test\n\nTest\n\n" 19 | block_md = Markdown.parse(""" 20 | # MDFlatten test 21 | 22 | 23 | ^^^ Ignoring extra whitespace. 24 | 25 | ```markdown 26 | code 27 | is forwarded as **is** 28 | ``` 29 | """) 30 | block_text = """ 31 | MDFlatten test 32 | 33 | ^^^ Ignoring extra whitespace. 34 | 35 | code 36 | is forwarded as **is** 37 | 38 | """ 39 | @test mdflatten(block_md) == block_text 40 | 41 | # blocks 42 | @test mdflatten(Markdown.parse("> Test\n> Test\n\n> Test")) == "Test Test\n\nTest\n\n" 43 | @test mdflatten(Markdown.parse("HRs\n\n---\n\nto whitespace")) == "HRs\n\n\n\nto whitespace\n\n" 44 | @test mdflatten(Markdown.parse("HRs\n\n---\n\nto whitespace")) == "HRs\n\n\n\nto whitespace\n\n" 45 | @test mdflatten(Markdown.parse("HRs\n\n---\n\nto whitespace")) == "HRs\n\n\n\nto whitespace\n\n" 46 | 47 | # test some inline blocks 48 | @test mdflatten(Markdown.parse("`code` *em* normal **strong**")) == "code em normal strong\n\n" 49 | @test mdflatten(Markdown.parse("[link text *parsed*](link/itself/ignored)")) == "link text parsed\n\n" 50 | @test mdflatten(Markdown.parse("- a\n- b\n- c")) == "a\nb\nc\n\n" 51 | @test mdflatten(Markdown.parse("A | B\n---|---\naa|bb\ncc | dd")) == "A B\naa bb\ncc dd\n\n" 52 | 53 | # Math 54 | @test mdflatten(Markdown.parse("\$e=mc^2\$")) == "e=mc^2\n\n" 55 | if VERSION > v"0.5-" 56 | # backticks and blocks for math only in 0.5, i.e. these fail on 0.4 57 | @test mdflatten(Markdown.parse("``e=mc^2``")) == "e=mc^2\n\n" 58 | @test mdflatten(Markdown.parse("```math\n\\(m+n)(m-n)\nx=3\\sin(x)\n```")) == "(m+n)(m-n)\nx=3sin(x)\n\n" 59 | end 60 | 61 | # symbols in markdown 62 | @test mdflatten(Markdown.parse("A \$B C")) == "A B C\n\n" 63 | 64 | # linebreaks 65 | @test mdflatten(Markdown.parse("A\\\nB")) == "A\nB\n\n" 66 | 67 | # Only available on Julia 0.5. 68 | if isdefined(Base.Markdown, :Footnote) 69 | @test mdflatten(Markdown.parse("[^name]")) == "[name]\n\n" 70 | @test mdflatten(Markdown.parse("[^name]:**Strong** text.")) == "[name]: Strong text.\n\n" 71 | end 72 | 73 | if isdefined(Base.Markdown, :Admonition) 74 | @test mdflatten(Markdown.parse("!!! note \"Admonition Title\"\n Test")) == "note: Admonition Title\nTest\n\n" 75 | end 76 | end 77 | 78 | end 79 | -------------------------------------------------------------------------------- /test/docsystem.jl: -------------------------------------------------------------------------------- 1 | module DocSystemTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | import Documenter: Documenter, DocSystem 11 | 12 | const alias_of_getdocs = DocSystem.getdocs # NOTE: won't get docstrings if in a @testset 13 | 14 | @testset "DocSystem" begin 15 | ## Bindings. 16 | @test_throws ArgumentError DocSystem.binding(9000) 17 | let b = Docs.Binding(current_module(), :DocSystem) 18 | @test DocSystem.binding(b) == b 19 | end 20 | let b = DocSystem.binding(Documenter.Documents.Document) 21 | @test b.mod === Documenter.Documents 22 | @test b.var === :Document 23 | end 24 | let b = DocSystem.binding(Documenter) 25 | @test b.mod === Main 26 | @test b.var === :Documenter 27 | end 28 | let b = DocSystem.binding(:Main) 29 | # @test b.mod === Main 30 | @test b.var === :Main 31 | end 32 | let b = DocSystem.binding(DocSystem.binding) 33 | @test b.mod === DocSystem 34 | @test b.var === :binding 35 | end 36 | let b = DocSystem.binding(Documenter, :Documenter) 37 | @test b.mod === Main 38 | @test b.var === :Documenter 39 | end 40 | 41 | ## `MultiDoc` object. 42 | @test isdefined(DocSystem, :MultiDoc) 43 | @test fieldnames(DocSystem.MultiDoc) == [:order, :docs] 44 | 45 | ## `DocStr` object. 46 | @test isdefined(DocSystem, :DocStr) 47 | @test fieldnames(DocSystem.DocStr) == [:text, :object, :data] 48 | 49 | ## `getdocs`. 50 | let b = DocSystem.binding(DocSystem, :getdocs), 51 | d_0 = DocSystem.getdocs(b, Tuple{}), 52 | d_1 = DocSystem.getdocs(b), 53 | d_2 = DocSystem.getdocs(b, Union{Tuple{ANY}, Tuple{ANY, Type}}; compare = (==)), 54 | d_3 = DocSystem.getdocs(b; modules = Module[Main]), 55 | d_4 = DocSystem.getdocs(DocSystem.binding(current_module(), :alias_of_getdocs)), 56 | d_5 = DocSystem.getdocs(DocSystem.binding(current_module(), :alias_of_getdocs); aliases = false) 57 | 58 | @test length(d_0) == 0 59 | @test length(d_1) == 2 60 | @test length(d_2) == 1 61 | @test length(d_3) == 0 62 | @test length(d_4) == 2 63 | @test length(d_5) == 0 64 | 65 | @test d_1[1].data[:binding] == b 66 | @test d_1[2].data[:binding] == b 67 | @test d_1[1].data[:typesig] == Union{Tuple{Docs.Binding}, Tuple{Docs.Binding, Type}} 68 | @test d_1[2].data[:typesig] == Union{Tuple{ANY}, Tuple{ANY, Type}} 69 | @test d_1[1].data[:module] == DocSystem 70 | @test d_1[2].data[:module] == DocSystem 71 | 72 | @test d_2[1].data[:binding] == b 73 | @test d_2[1].data[:typesig] == Union{Tuple{ANY}, Tuple{ANY, Type}} 74 | @test d_2[1].data[:module] == DocSystem 75 | 76 | @test d_1 == d_4 77 | @test d_1 != d_5 78 | end 79 | end 80 | 81 | end 82 | -------------------------------------------------------------------------------- /docs/src/man/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This page details the some of the guidelines that should be followed when contributing to this package. 4 | 5 | ## Branches 6 | 7 | From `Documenter` version `0.3` onwards `release-*` branches are used for tagged minor versions of this package. This follows the same approach used in the main Julia repository, albeit on a much more modest scale. 8 | 9 | Please open pull requests against the `master` branch rather than any of the `release-*` branches whenever possible. 10 | 11 | ## Backports 12 | 13 | Bug fixes are backported to the `release-*` branches using `git cherry-pick -x` by a JuliaDocs member and will become available in point releases of that particular minor version of the package. 14 | 15 | Feel free to nominate commits that should be backported by opening an issue. Requests for new point releases to be tagged in `METADATA.jl` can also be made in the same way. 16 | 17 | ## Style Guide 18 | 19 | Follow the style of the surrounding text when making changes. When adding new features please try to stick to the following points whenever applicable. 20 | 21 | ### Julia 22 | 23 | * 4-space indentation; 24 | * modules spanning entire files should not be indented, but modules that have surrounding code should; 25 | * no blank lines at the start or end of files; 26 | * do not manually align syntax such as `=` or `::` over adjacent lines; 27 | * use `local` to define new local variables so that they are easier to locate; 28 | * use `function ... end` when a method definition contains more than one toplevel expression; 29 | * related short-form method definitions don't need a new line between them; 30 | * unrelated or long-form method definitions must have a blank line separating each one; 31 | * surround all binary operators with whitespace except for `::`, `^`, and `:`; 32 | * files containing a single `module ... end` must be named after the module; 33 | * method arguments should be ordered based on the amount of usage within the method body; 34 | * methods extended from other modules must follow their inherited argument order, not the above rule; 35 | * explicit `return` should be preferred except in short-form method definitions; 36 | * avoid dense expressions where possible e.g. prefer nested `if`s over complex nested `?`s; 37 | * include a trailing `,` in vectors, tuples, or method calls that span several lines; 38 | * do not use multiline comments (`#=` and `=#`); 39 | * wrap long lines as near to 92 characters as possible, this includes docstrings; 40 | * follow the standard naming conventions used in `Base`. 41 | 42 | ### Markdown 43 | 44 | * Use unbalanced `#` headers, i.e. no `#` on the right hand side of the header text; 45 | * include a single blank line between toplevel blocks; 46 | * unordered lists must use `*` bullets with two preceding spaces; 47 | * do *not* hard wrap lines; 48 | * use emphasis (`*`) and bold (`**`) sparingly; 49 | * always use fenced code blocks instead of indented blocks; 50 | * follow the conventions outlined in the Julia documentation page on documentation. 51 | -------------------------------------------------------------------------------- /src/Generator.jl: -------------------------------------------------------------------------------- 1 | """ 2 | Provides the functions related to generating documentation stubs. 3 | """ 4 | module Generator 5 | 6 | using DocStringExtensions 7 | 8 | """ 9 | $(SIGNATURES) 10 | 11 | Attempts to save a file at `\$(root)/\$(filename)`. `f` will be called with file 12 | stream (see [`open`](http://docs.julialang.org/en/latest/stdlib/io-network/#Base.open)). 13 | 14 | `filename` can also be a file in a subdirectory (e.g. `src/index.md`), and then 15 | then subdirectories will be created automatically. 16 | """ 17 | function savefile(f, root, filename) 18 | filepath = joinpath(root, filename) 19 | if ispath(filepath) error("$(filepath) already exists") end 20 | info("Generating $filename at $filepath") 21 | mkpath(dirname(filepath)) 22 | open(f,filepath,"w") 23 | end 24 | 25 | """ 26 | $(SIGNATURES) 27 | 28 | Contents of the default `make.jl` file. 29 | """ 30 | function make(pkgname) 31 | """ 32 | using Documenter 33 | using $(pkgname) 34 | 35 | makedocs( 36 | modules = [$(pkgname)] 37 | ) 38 | 39 | # Documenter can also automatically deploy documentation to gh-pages. 40 | # See "Hosting Documentation" and deploydocs() in the Documenter manual 41 | # for more information. 42 | #=deploydocs( 43 | repo = "" 44 | )=# 45 | """ 46 | end 47 | 48 | """ 49 | $(SIGNATURES) 50 | 51 | Contents of the default `.gitignore` file. 52 | """ 53 | function gitignore() 54 | """ 55 | build/ 56 | site/ 57 | """ 58 | end 59 | 60 | mkdocs_default(name, value, default) = value == nothing ? "#$name$default" : "$name$value" 61 | 62 | """ 63 | $(SIGNATURES) 64 | 65 | Contents of the default `mkdocs.yml` file. 66 | """ 67 | function mkdocs(pkgname; 68 | description = nothing, 69 | author = nothing, 70 | url = nothing 71 | ) 72 | s = """ 73 | # See the mkdocs user guide for more information on these settings. 74 | # http://www.mkdocs.org/user-guide/configuration/ 75 | 76 | site_name: $(pkgname).jl 77 | $(mkdocs_default("repo_url: ", url, "https://github.com/USER_NAME/PACKAGE_NAME.jl")) 78 | $(mkdocs_default("site_description: ", description, "Description...")) 79 | $(mkdocs_default("site_author: ", author, "USER_NAME")) 80 | 81 | theme: readthedocs 82 | 83 | extra_css: 84 | - assets/Documenter.css 85 | 86 | extra_javascript: 87 | - https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML 88 | - assets/mathjaxhelper.js 89 | 90 | markdown_extensions: 91 | - extra 92 | - tables 93 | - fenced_code 94 | - mdx_math 95 | 96 | docs_dir: 'build' 97 | 98 | pages: 99 | - Home: index.md 100 | """ 101 | end 102 | 103 | """ 104 | $(SIGNATURES) 105 | 106 | Contents of the default `src/index.md` file. 107 | """ 108 | function index(pkgname) 109 | """ 110 | # $(pkgname).jl 111 | 112 | Documentation for $(pkgname).jl 113 | """ 114 | end 115 | 116 | end 117 | -------------------------------------------------------------------------------- /assets/html/search.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Part of Documenter.jl 3 | * https://github.com/JuliaDocs/Documenter.jl 4 | * 5 | * License: MIT 6 | */ 7 | 8 | // parseUri 1.2.2 9 | // (c) Steven Levithan 10 | // MIT License 11 | function parseUri (str) { 12 | var o = parseUri.options, 13 | m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), 14 | uri = {}, 15 | i = 14; 16 | 17 | while (i--) uri[o.key[i]] = m[i] || ""; 18 | 19 | uri[o.q.name] = {}; 20 | uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { 21 | if ($1) uri[o.q.name][$1] = $2; 22 | }); 23 | 24 | return uri; 25 | }; 26 | parseUri.options = { 27 | strictMode: false, 28 | key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], 29 | q: { 30 | name: "queryKey", 31 | parser: /(?:^|&)([^&=]*)=?([^&]*)/g 32 | }, 33 | parser: { 34 | strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, 35 | loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ 36 | } 37 | }; 38 | 39 | requirejs.config({ 40 | paths: { 41 | 'jquery': 'https://code.jquery.com/jquery-3.1.0.js?', 42 | 'lunr': 'https://cdnjs.cloudflare.com/ajax/libs/lunr.js/0.7.1/lunr.min', 43 | } 44 | }); 45 | 46 | var currentScript = document.currentScript; 47 | 48 | require(["jquery", "lunr"], function($, lunr) { 49 | var index = lunr(function () { 50 | this.ref('location') 51 | this.field('title', {boost: 10}) 52 | this.field('text') 53 | }) 54 | var store = {} 55 | 56 | documenterSearchIndex['docs'].forEach(function(e) { 57 | index.add(e) 58 | store[e.location] = e 59 | }) 60 | 61 | $(function(){ 62 | function update_search(query) { 63 | results = index.search(query) 64 | $('#search-info').text("Number of results: " + results.length) 65 | $('#search-results').empty() 66 | results.forEach(function(result) { 67 | data = store[result.ref] 68 | link = $('') 69 | link.text(data.title) 70 | link.attr('href', documenterBaseURL+'/'+result.ref) 71 | cat = $('('+data.category+')') 72 | li = $('
  • ').append(link).append(cat) 73 | $('#search-results').append(li) 74 | }) 75 | } 76 | 77 | function update_search_box() { 78 | query = $('#search-query').val() 79 | update_search(query) 80 | } 81 | 82 | $('#search-query').keyup(update_search_box) 83 | $('#search-query').change(update_search_box) 84 | 85 | search_query = parseUri(window.location).queryKey["q"] 86 | if(search_query !== undefined) { 87 | $("#search-query").val(search_query) 88 | } 89 | update_search_box(); 90 | }) 91 | }) 92 | -------------------------------------------------------------------------------- /test/examples/make.jl: -------------------------------------------------------------------------------- 1 | # Defines the modules referred to in the example docs (under src/) and then builds them. 2 | # It can be called separately to build the examples/, or as part of the test suite. 3 | # 4 | # It defines a set of variables (`examples_*`) that can be used in the tests. 5 | # The `examples_root` should be used to check whether this file has already been included 6 | # or not and should be kept unique. 7 | isdefined(:examples_root) && error("examples_root is already defined\n$(@__FILE__) included multiple times?") 8 | 9 | # The `Mod` and `AutoDocs` modules are assumed to exists in the Main module. 10 | current_module() === Main || error("$(@__FILE__) must be included into Main.") 11 | 12 | # Modules `Mod` and `AutoDocs` 13 | module Mod 14 | """ 15 | func(x) 16 | 17 | [`T`](@ref) 18 | """ 19 | func(x) = x 20 | 21 | """ 22 | T 23 | 24 | [`func(x)`](@ref) 25 | """ 26 | type T end 27 | end 28 | 29 | "`AutoDocs` module." 30 | module AutoDocs 31 | module Pages 32 | include("pages/a.jl") 33 | include("pages/b.jl") 34 | include("pages/c.jl") 35 | include("pages/d.jl") 36 | include("pages/e.jl") 37 | end 38 | 39 | "Function `f`." 40 | f(x) = x 41 | 42 | "Constant `K`." 43 | const K = 1 44 | 45 | "Type `T`." 46 | type T end 47 | 48 | "Macro `@m`." 49 | macro m() end 50 | 51 | "Module `A`." 52 | module A 53 | "Function `A.f`." 54 | f(x) = x 55 | 56 | "Constant `A.K`." 57 | const K = 1 58 | 59 | "Type `B.T`." 60 | type T end 61 | 62 | "Macro `B.@m`." 63 | macro m() end 64 | end 65 | 66 | "Module `B`." 67 | module B 68 | "Function `B.f`." 69 | f(x) = x 70 | 71 | "Constant `B.K`." 72 | const K = 1 73 | 74 | "Type `B.T`." 75 | type T end 76 | 77 | "Macro `B.@m`." 78 | macro m() end 79 | end 80 | end 81 | 82 | # Build example docs 83 | using Documenter 84 | 85 | const examples_root = dirname(@__FILE__) 86 | 87 | info("Building mock package docs: MarkdownWriter") 88 | examples_markdown_doc = makedocs( 89 | debug = true, 90 | root = examples_root, 91 | build = "builds/markdown", 92 | ) 93 | 94 | info("Building mock package docs: HTMLWriter") 95 | examples_html_doc = makedocs( 96 | debug = true, 97 | root = examples_root, 98 | build = "builds/html", 99 | format = :html, 100 | assets = ["assets/custom.css"], 101 | sitename = "Documenter example", 102 | pages = Any[ 103 | "Home" => "index.md", 104 | "Manual" => [ 105 | "man/tutorial.md", 106 | ], 107 | hide("hidden.md"), 108 | "Library" => [ 109 | "lib/functions.md", 110 | "lib/autodocs.md", 111 | ], 112 | hide("Hidden Pages" => "hidden/index.md", Any[ 113 | "Page X" => "hidden/x.md", 114 | "hidden/y.md", 115 | "hidden/z.md", 116 | ]) 117 | ] 118 | ) 119 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Documenter 3 | 4 | *A documentation generator for Julia.* 5 | 6 | | **Documentation** | **PackageEvaluator** | **Build Status** | 7 | |:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:| 8 | | [![][docs-stable-img]][docs-stable-url] [![][docs-latest-img]][docs-latest-url] | [![][pkg-0.4-img]][pkg-0.4-url] [![][pkg-0.5-img]][pkg-0.5-url] [![][pkg-0.6-img]][pkg-0.6-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][codecov-img]][codecov-url] | 9 | 10 | 11 | ## Installation 12 | 13 | The package is registered in `METADATA.jl` and so can be installed with `Pkg.add`. 14 | 15 | ```julia 16 | julia> Pkg.add("Documenter") 17 | ``` 18 | 19 | ## Documentation 20 | 21 | - [**STABLE**][docs-stable-url] — **most recently tagged version of the documentation.** 22 | - [**LATEST**][docs-latest-url] — *in-development version of the documentation.* 23 | 24 | ## Project Status 25 | 26 | The package is tested against Julia `0.4`, `0.5`, and *current* `0.6-dev` on Linux, OS X, and Windows. 27 | 28 | ## Contributing and Questions 29 | 30 | Contributions are very welcome, as are feature requests and suggestions. The [contributing][contrib-url] page details the guidelines that should be followed when opening pull requests. 31 | 32 | Please open an [issue][issues-url] if you encounter any problems. If you have a question then feel free to ask for help in the [Gitter chat room][gitter-url]. 33 | 34 | [gitter-url]: https://gitter.im/juliadocs/users 35 | 36 | [contrib-url]: https://juliadocs.github.io/Documenter.jl/latest/man/contributing/ 37 | 38 | [docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg 39 | [docs-latest-url]: https://juliadocs.github.io/Documenter.jl/latest 40 | 41 | [docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg 42 | [docs-stable-url]: https://juliadocs.github.io/Documenter.jl/stable 43 | 44 | [travis-img]: https://travis-ci.org/JuliaDocs/Documenter.jl.svg?branch=master 45 | [travis-url]: https://travis-ci.org/JuliaDocs/Documenter.jl 46 | 47 | [appveyor-img]: https://ci.appveyor.com/api/projects/status/egdu3hrptf3mnfc6/branch/master?svg=true 48 | [appveyor-url]: https://ci.appveyor.com/project/MichaelHatherly/documenter-jl-bqgcw/branch/master 49 | 50 | [codecov-img]: https://codecov.io/gh/JuliaDocs/Documenter.jl/branch/master/graph/badge.svg 51 | [codecov-url]: https://codecov.io/gh/JuliaDocs/Documenter.jl 52 | 53 | [issues-url]: https://github.com/JuliaDocs/Documenter.jl/issues 54 | 55 | [pkg-0.4-img]: http://pkg.julialang.org/badges/Documenter_0.4.svg 56 | [pkg-0.4-url]: http://pkg.julialang.org/?pkg=Documenter 57 | [pkg-0.5-img]: http://pkg.julialang.org/badges/Documenter_0.5.svg 58 | [pkg-0.5-url]: http://pkg.julialang.org/?pkg=Documenter 59 | [pkg-0.6-img]: http://pkg.julialang.org/badges/Documenter_0.6.svg 60 | [pkg-0.6-url]: http://pkg.julialang.org/?pkg=Documenter 61 | -------------------------------------------------------------------------------- /test/dom.jl: -------------------------------------------------------------------------------- 1 | module DOMTests 2 | 3 | if VERSION >= v"0.5.0-dev+7720" 4 | using Base.Test 5 | else 6 | using BaseTestNext 7 | const Test = BaseTestNext 8 | end 9 | 10 | import Documenter.Utilities.DOM: DOM, @tags, HTMLDocument 11 | 12 | @tags div ul li p 13 | 14 | @testset "DOM" begin 15 | for tag in (:div, :ul, :li, :p) 16 | TAG = getfield(current_module(), tag) 17 | @test isdefined(tag) 18 | @test isa(TAG, DOM.Tag) 19 | @test TAG.name === tag 20 | end 21 | 22 | @test div().name === :div 23 | @test div().text == "" 24 | @test isempty(div().nodes) 25 | @test isempty(div().attributes) 26 | 27 | @test div("...").name === :div 28 | @test div("...").text == "" 29 | @test length(div("...").nodes) === 1 30 | @test div("...").nodes[1].text == "..." 31 | @test div("...").nodes[1].name === Symbol("") 32 | @test isempty(div("...").attributes) 33 | 34 | @test div[".class"]("...").name === :div 35 | @test div[".class"]("...").text == "" 36 | @test length(div[".class"]("...").nodes) === 1 37 | @test div[".class"]("...").nodes[1].text == "..." 38 | @test div[".class"]("...").nodes[1].name === Symbol("") 39 | @test length(div[".class"]("...").attributes) === 1 40 | @test div[".class"]("...").attributes[1] == (:class => "class") 41 | @test div[:attribute].attributes[1] == (:attribute => "") 42 | @test div[:attribute => "value"].attributes[1] == (:attribute => "value") 43 | 44 | let d = div(ul(map(li, [string(n) for n = 1:10]))) 45 | @test d.name === :div 46 | @test d.text == "" 47 | @test isempty(d.attributes) 48 | @test length(d.nodes) === 1 49 | let u = d.nodes[1] 50 | @test u.name === :ul 51 | @test u.text == "" 52 | @test isempty(u.attributes) 53 | @test length(u.nodes) === 10 54 | for n = 1:10 55 | let v = u.nodes[n] 56 | @test v.name === :li 57 | @test v.text == "" 58 | @test isempty(v.attributes) 59 | @test length(v.nodes) === 1 60 | @test v.nodes[1].name === Symbol("") 61 | @test v.nodes[1].text == string(n) 62 | @test !isdefined(v.nodes[1], :attributes) 63 | @test !isdefined(v.nodes[1], :nodes) 64 | end 65 | end 66 | end 67 | end 68 | 69 | @tags script style img 70 | 71 | @test string(div(p("one"), p("two"))) == "

    one

    two

    " 72 | @test string(div[:key => "value"]) == "
    " 73 | @test string(p(" < > & ' \" ")) == "

    < > & ' "

    " 74 | @test string(img[:src => "source"]) == "" 75 | @test string(img[:none]) == "" 76 | @test string(script(" < > & ' \" ")) == "" 77 | @test string(style(" < > & ' \" ")) == "" 78 | @test string(script) == "