| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a few fixes for when using code blocks with lines numbered
- Use CSS variables for the colours so that it works in dark mode
- Don't turn on normal table effects like hover and smaller font when
its a line number table
- With dochack.nim, don't add a clipboard copy button for the line
numbers at the side
[Example page showing the
changes](https://66dcde6e4a655efb70771d9a--dazzling-kitten-6c3419.netlify.app/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#23154)
Before (devel)
![image](https://github.com/nim-lang/Nim/assets/43030857/cde37109-027a-46c1-a37e-1d6062e6c609)
After (this PR and stable)
![image](https://github.com/nim-lang/Nim/assets/43030857/3366877c-7223-4749-a584-fe93f731281f)
It now keeps the same behavior as before
|
|
|
|
|
|
|
|
|
|
| |
... by moving the Google font includes near the top of the head. By
including them as early as possible, they are known, when the browser
starts rendering the body.
Test it by making the change manually in `doc/html/system.html` and then
press ctrl+f5 (reload without cache). This removes the font flashing.
Tested in Chrome and Firefox.
|
|
|
| |
closes #15176
|
|
|
|
|
|
|
|
|
| |
Makes docs default to using browser settings instead of light mode
This should fix #16515 since it doesn't require the browser to run the
JS to set the default
Also means that dark mode can be used without JS if the browser is
configured to default to dark mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rendering of `nkRecList` produces an indent and adds a new line at the
end. However for things like case object `of`/`else` branches or `when`
branches this is already done, so this produces 2 indents and an extra
new line. Instead, just add an indent in the place where the indent that
`nkRecList` produces is needed, for the rendering of the final node of
`nkObjectTy`. There doesn't seem to be a need to add the newline.
Before:
```nim
case x*: bool
of true:
y*: int
of false:
nil
```
After:
```nim
case x*: bool
of true:
y*: int
of false:
nil
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix #22492
* Update nimdoc.css
remove scroll-y
* Update nimdoc.out.css
* Update nimdoc.css
* make it sticky again
* Update nimdoc.out.css
* danm sticky, use fixed
* Update nimdoc.out.css
* fix margin
* Update nimdoc.out.css
* make search input react to any change (not just keyboard events) according to https://github.com/nim-lang/Nim/pull/22511#issuecomment-1685218787
|
|
|
|
|
|
|
|
|
| |
* nimdoc: stick search result inside browser viewport
* fix nimdoc.out.css
---------
Co-authored-by: Locria Cyber <74560659+locriacyber@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
| |
* fix server caching issue causing Theme failures
* Fix tester to ignore version cache param
* fix case of people using -d:nimTestsNimdocFixup
* rsttester needed the same fix
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add example object into testproject
The proc is there to check the case of an identDef being inside an identDef (We do want to render those even if they are not exported)
* Add `inside` set to `TSrcGen` which allows us to see what context we are in
This is done instead of adding another inXyz bool parameter
We then use this to know if we are inside an object when rendering an nkIdentDefs (To know if we need to skip rendering it)
* Update test files
|
|
|
|
|
|
|
|
|
| |
objects (#21743)
* fixes #21483; skipPragmaExpr
* add a test case for #21483
* fixes HTML
|
|
|
|
|
|
|
| |
This fixes a regression introduced in #20990 . When a group referencing
is used and one of the overloaded symbols is in `include`d file, then
`nim doc` crashes. The fix is in distinguishing (the index of) module
and file where the symbol is defined, and using only module as the
key in hash table for group referencing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
parses the whole module at one time (#21379)
* fixes #19795; remove parse pipeline
* isScript
* fixes nimscriptapi
* don't touch reorder
* check script
* fixes tests
* it seems implicit imports of system cause troubles
* access the first child of `nkStmtList`
* ignore comments
* minor messages
* perhaps increases hloLoopDetector
* the module is a stmtList, which changes the errors
* fixes nimdoc
* fixes tlinter
* fixes nim secret tests
* fixes arc_misc
* fixes nim secret tests again
* safe; fixes one more test
* GlobalError is the root cause too
* fixes parsing errors
* put emit types to the cfsForwardTypes section
* fixes #11852; `{.push checks:off}` now works in procs
* disable navigator
* fixes nimdoc
* add tests for JS
* fixes nimsuggest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* suppresses non-exported fields of types and adds command-line option to re-enable this if desired
* corrected the doctest that produced a CI error
* an embarrassingly bad error in reasoning
* modified a nimdoc test to reflect updated behavior
* needed another change to bring utils.html doctest in sync with update
* add info
* fix nimdoc
* lint
* render postfix
* fixes a problem
* fixes nimdoc
* fix nimdoc
---------
Co-authored-by: johnperry-math <john.perry@usm.edu>
Co-authored-by: johnperry-math <devotus@yahoo.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* docgen: implement cross-document links
Fully implements https://github.com/nim-lang/RFCs/issues/125
Follow-up of: https://github.com/nim-lang/Nim/pull/18642 (for internal links)
and https://github.com/nim-lang/Nim/issues/20127.
Overview
--------
Explicit import-like directive is required, called `.. importdoc::`.
(the syntax is % RST, Markdown will use it for a while).
Then one can reference any symbols/headings/anchors, as if they
were in the local file (but they will be prefixed with a module name
or markup document in link text).
It's possible to reference anything from anywhere (any direction
in `.nim`/`.md`/`.rst` files).
See `doc/docgen.md` for full description.
Working is based on `.idx` files, hence one needs to generate
all `.idx` beforehand. A dedicated option `--index:only` is introduced
(and a separate stage for `--index:only` is added to `kochdocs.nim`).
Performance note
----------------
Full run for `./koch docs` now takes 185% of the time before this PR.
(After: 315 s, before: 170 s on my PC).
All the time seems to be spent on `--index:only` run, which takes
almost as much (85%) of normal doc run -- it seems that most time
is spent on file parsing, turning off HTML generation phase has not
helped much.
(One could avoid it by specifying list of files that can be referenced
and pre-processing only them. But it can become error-prone and I assume
that these linke will be **everywhere** in the repository anyway,
especially considering https://github.com/nim-lang/RFCs/issues/478.
So every `.nim`/`.md` file is processed for `.idx` first).
But that's all without significant part of repository converted to
cross-module auto links. To estimate impact I checked the time for
`doc`ing a few files (after all indexes have been generated), and
everywhere difference was **negligible**.
E.g. for `lib/std/private/osfiles.nim` that `importdoc`s large
`os.idx` and hence should have been a case with relatively large
performance impact, but:
* After: 0.59 s.
* Before: 0.59 s.
So Nim compiler works so slow that doc part basically does not matter :-)
Testing
-------
1) added `extlinks` test to `nimdoc/`
2) checked that `theindex.html` is still correct
2) fixed broken auto-links for modules that were derived from `os.nim`
by adding appropriate ``importdoc``
Implementation note
-------------------
Parsing and formating of `.idx` entries is moved into a dedicated
`rstidx.nim` module from `rstgen.nim`.
`.idx` file format changed:
* fields are not escaped in most cases because we need original
strings for referencing, not HTML ones
(the exception is linkTitle for titles and headings).
Escaping happens later -- on the stage of `rstgen` buildIndex, etc.
* all lines have fixed number of columns 6
* added discriminator tag as a first column,
it always allows distinguish Nim/markup entries, titles/headings, etc.
`rstgen` does not rely any more (in most cases) on ad-hoc logic
to determine what type each entry is.
* there is now always a title entry added at the first line.
* add a line number as 6th column
* linkTitle (4th) column has a different format: before it was like
`module: funcName()`, now it's `proc funcName()`.
(This format is also propagated to `theindex.html` and search results,
I kept it that way since I like it more though it's discussible.)
This column is what used for Nim symbols resolution.
* also changed details on column format for headings and titles:
"keyword" is original, "linkTitle" is HTML one
* fix paths on Windows + more clear code
* Update compiler/docgen.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Handle .md and .nim paths uniformly in findRefFile
* handle titles better + more comments
* don't allow markup overwrite index title for .nim files
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Name iterators something human readable
Remove intermediate async procs from stacktraces
Clean async traceback message from reraises message
* Remove unused import/variable
* Fix failing tests
Don't add {.stackTrace: off.} to anonymous procs (They already don't appear in stacktrace)
* Fix failing tests in pragma category
Now check that the nim is a routine type first so we don't run into any assertion defects
* Hide stack trace pragma in docs and update doc tests
User doesn't need to know if something won't appear so this more becomes verbose noise
If this is a bad idea we can always add a `when defined(nimdoc)` switch so we don't add {.stackTrace: off.} to the Future[T] returning proc for docs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Trying to fix by changing renderer
* add renderExpandUsing flag
This flag makes the renderer expand parameters that use using statement to have their full type
* Update docs
* Make comment better explain why checking for nkSym
* Fix nil access when macro/template has parameter with no type
* Fix nil access when node is not semmed yet
|
|
|
|
|
|
|
| |
* Use link from webpage. Closes #14476
* Update doc generation tests
* Update RST test
|
|
|
|
|
|
|
| |
* move google fonts to the last part
* fixes tests
* fix rst2html
|
|
|
|
|
| |
* fixes #20524; add forbids pragmas to hideable lists
* fixes nimdoc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement Pandoc Markdown concise link extension
This implements https://github.com/nim-lang/Nim/issues/20127.
Besides reference to headings we also support doing references
to Nim symbols inside Nim modules.
Markdown:
```
Some heading
------------
Ref. [Some heading].
```
Nim:
```
proc someFunction*() ...
... ## Ref. [someFunction]
```
This is substitution for RST syntax like `` `target`_ ``.
All 3 syntax variants of extension from Pandoc Markdown are supported:
`[target]`, `[target][]`, `[description][target]`.
This PR also fixes clashes in existing files, particularly
conflicts with RST footnote feature, which does not work with
this PR (but there is a plan to adopt a popular [Markdown footnote
extension](https://pandoc.org/MANUAL.html#footnotes) to make footnotes work).
Also the PR fixes a bug that Markdown links did not work when `[...]`
section had a line break.
The implementation is straightforward since link resolution did not
change w.r.t. RST implementation, it's almost only about new syntax
addition. The only essential difference is a possibility to add a custom
link description: form `[description][target]` which does not have an
RST equivalent.
* fix nim 1.0 gotcha
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add `doctype: RST|Markdown|RstMarkdown` pragma
Implements https://github.com/nim-lang/RFCs/issues/68 ,
see also discussion in https://github.com/nim-lang/Nim/issues/17987
The permitted values:
* `markdown`, which is default. It still contains nearly all of
the RST supported but it is assumed that in time we will give up
most or all RST features in this mode
* `rst`, without any extensions
* `RstMarkdown` — compatibility with Nim 1.x. It's basically RST
with those Markdown features enabled that don't conflict with RST.
* Apply suggestions from code review
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Additional fix in spirit of review
* Fix test after #20188
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement auto dark mode
* Rename class
* Fix borders cutout
* Apply suggestions from code review
* Apply suggestions from code review
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* .forbids pragma: defining illegal effects for proc types
This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc.
* updated documentation and changelogs for the forbids pragma
* renamed notTagEffects to forbiddenEffects
* corrected issues of forbids pragma
the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping
* removed incorrect character from changelog
* added test to cover the interaction of methods and the forbids pragma
* covering the interaction of the tags and forbids pragmas
* updated manual about the forbids pragma
* removed useless statement
* corrected the subtyping of proc types using the forbids pragma
* updated manual for the forbids pragma
* updated documentations for forbids pragma
* updated nim docs
* updated docs with rsttester.nim
* regenerated documentation
* updated rst docs
* Update changelog.md
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* updated changelog
* corrected typo
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
| |
* Don't make a section be a dropdown if it has no child links
* - Cleaned up code
- Updated tests
* Document what the 'if' is checking
|
|
|
| |
Fixed tocRoot placement
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* [docgen] Group sidebar sections into <details> (open by default)
* [docgen] Consistent indentation in generated HTML
(this is a boon for working on docgen's html/css output)
* [docgen] Move Source/Edit buttons inside main div
This makes styling the documentation significantly easier.
* [docgen] Somewhat consistent CSS formatting
* [docgen] Keep the sidebar onscreen while scrolling
* [docgen] Tweak CSS for the sticky sidebar
* [docgen] search type=text ==> type=search
* [docgen] Update expected doc output
* [docgen] Fix Group by Type sidebar placement bug
* [docgen] Curse you, whitespace (fix tests)
* [docgen] Fix rst2html tests
Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
|
|
|
|
|
|
|
| |
* rewrite docs JS in Nim
* fixup
* fix nimdoc/rsttester
|
|
|
| |
in group name)
|
|
|
|
|
|
|
| |
* implement RST & Markdown quote blocks
* compile with nim 1.0
* Fix indentation
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* feat: copy to clipboard
* fix: CI failure related issue
* fix: CI failure issue
* fix: copy to clipboard button bug
* feat: copy pragmadots value to clipboard
|
| |
|
|
|
|
|
|
| |
(#18796)
* we need something better than warningAsError for effect handling violations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #17369
* megatest is green for --cpu:arm64
* docgen output includes more tags/raises
* implemented 'effectsOf'
* algorithm.nim: uses new effectsOf annotation
* closes #18376
* closes #17475
* closes #13905
* allow effectsOf: [a, b]
* added a test case
* parameters that are not ours cannot be declared as .effectsOf
* documentation
* manual: added the 'sort' example
* bootstrap with the new better options
|
| |
|
|
|
|
| |
* support same-line comments in routines
* remove assert as per review comment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* docgen: sort symbols (fix #17910)
* add workaround + change naming
* switch to a dedicated sort comparator
* fix numbers with unequal string lengths
* dedicated `sortName` instead of `plainNameEsc`:
* more compact names for non-overloaded symbols
* more predictable Ascii sort (e.g. `<` instead of `<`)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* docgen: move to shared RST state (fix #16990)
* Update lib/packages/docutils/rst.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Update lib/packages/docutils/rst.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Update lib/packages/docutils/rst.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Update compiler/docgen.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* Update compiler/docgen.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* Update compiler/docgen.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* Update lib/packages/docutils/rst.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* rename `cmdDoc2` to `cmdDoc`
* fix (P)RstSharedState convention
* new style of initialization
* misc suggestions
* 1 more rename
* fix a regression
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix JS error on index page and detect dark mode
The theindex.html page doesn't have a dark mode switch so the main
function will error because `toggleSwitch` is not defined. Checks have
been added to prevent this from happening.
Also add automatic detection of system settings for dark-mode. This
could also be done with pure css, but then the dark mode variable
declarations would have to be duplicated to work with the switch so I
went with this approach.
* Fix nimdoc tests
* Fix rst2html tests
|
|
|
|
| |
nested templates (#18082)
|
|
|
|
|
|
|
| |
* fix warnings/hints in nimdoc/tester.nim
* improve err msg for nimdoc/tester.nim and change flag from fixup to nimTestsNimdocFixup
* address comment: put back quit instead of doAssert
|
|
|
|
|
| |
* `doc2tex`: generate docs to Latex
* address some comments
|
|
|
|
|
| |
* follow-up #17837: add `Console` for interactive sessions
* fix Latex
|
|
|
|
|
| |
* typo: nonexistant => nonexistent
* fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expected vs gotten (#17892)
* gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten
* refactor with createTempDir
* cleanup
* refacotr
* PRTEMP fake test spec changes to show effect of diffStrings
* add runnableExamples for experimental/diff + cross-reference with gitutils
* Revert "PRTEMP fake test spec changes to show effect of diffStrings"
This reverts commit 57dc8d642dce6c1127c98b7cbc9edbfe747d4047.
|