Commit Graph

85 Commits

Author SHA1 Message Date
Lancer11211
efd5c571bf .forbids pragma: defining forbidden tags (#20050)
* .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>
2022-07-26 07:40:49 +02:00
Jake Leahy
c43a377057 Make imports/exports not be a dropdown in sidebar (#19907)
* 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
2022-07-16 17:41:18 -04:00
Jake Leahy
dd4cc266cd Fixes #19900 (#19906)
Fixed tocRoot placement
2022-06-19 07:36:33 +02:00
JJ
e7e8f437c4 Keep the doc sidebar on the screen while scrolling (#19851)
* [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>
2022-06-15 15:40:56 +02:00
flywind
ded8b0e541 rewrite docs JS in Nim (#19701)
* rewrite docs JS in Nim

* fixup

* fix nimdoc/rsttester
2022-04-09 17:50:57 +02:00
Andrey Makarov
19898e1225 Fix group reference (with capital letters (#19196)
in group name)
2021-12-20 15:10:15 -05:00
Andrey Makarov
040d23e799 implement RST & Markdown quote blocks (#19147)
* implement RST & Markdown quote blocks

* compile with nim 1.0

* Fix indentation
2021-11-23 13:02:03 +01:00
Andrey Makarov
7ba2659f73 docgen: implement doc link resolution in current module (#18642) 2021-10-28 19:20:52 +02:00
Abishek PY
d634587423 feat: copy to clipboard (#18963)
* 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
2021-10-22 12:10:32 +02:00
Andreas Rumpf
e0ef859130 strict effects (#18777)
* 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
2021-09-02 12:10:14 +02:00
Andrey Makarov
bbe05c1532 docgen: draw frame around active anchors (#18607) 2021-07-29 13:30:19 +02:00
Timothee Cour
8d2f6bba3a support same-line doc comments in routines (#18595)
* support same-line comments in routines
* remove assert as per review comment
2021-07-27 19:50:59 +02:00
Andrey Makarov
10da888c07 docgen: sort symbols (fix #17910) (#18560)
* 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 `&lt;`)
2021-07-25 23:01:19 +02:00
Timothee Cour
488e9c2991 nim doc now correctly renders deprecated pragmas for routines and types (#18515) 2021-07-19 12:42:45 +02:00
Andrey Makarov
590d457631 docgen: move to shared RST state (fix #16990) (#18256)
* 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>
2021-06-20 09:50:03 +02:00
drtheuns
51ab7ccec1 Fix JS error on index page and detect dark mode (#18191)
* 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
2021-06-07 18:40:09 +02:00
Timothee Cour
0de3d4292f fix #16993, #18054, #17835 runnableExamples now works with templates and nested templates (#18082) 2021-06-02 09:02:14 -07:00
Timothee Cour
e2ab08603d fix warnings/hints in nimdoc/tester.nim (#18083)
* 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
2021-05-30 22:40:42 +02:00
Andrey Makarov
97970d9dcc doc2tex: generate docs to Latex (#17997)
* `doc2tex`: generate docs to Latex

* address some comments
2021-05-14 07:30:47 +02:00
Andrey Makarov
436af88d8c follow-up #17837: add Console for interactive sessions (#17930)
* follow-up #17837: add `Console` for interactive sessions

* fix Latex
2021-05-06 10:58:01 +02:00
Timothee Cour
78e2d299df typo: nonexistant => nonexistent (#17918)
* typo: nonexistant => nonexistent

* fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
2021-05-02 00:26:41 +02:00
Timothee Cour
a424075b5e improve nimsuggest/tester, minor improvements to koch.nim (#17879)
* improve nimsuggest/tester

* koch improvements
2021-04-29 13:44:53 +02:00
Andrey Makarov
8f79bc5f3d add RST highlighting for command line / shells (also fixes #16858) (#17789) 2021-04-21 16:57:54 +02:00
Andrey Makarov
2150cd1826 restyle RST option lists (#17637)
* WIP: restyle RST option lists

* apply similar style to Latex

* fix tests

* minor visual tweaks

* update tests

* remove leftover comments
2021-04-10 09:49:01 +02:00
flywind
a807233aeb fix #17615(runnableExamples silently ignored if placed after some code) (#17619)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-04-02 18:26:30 -07:00
Andrey Makarov
e35946f306 enable syntax highlighting for inline code (#17585)
* enable syntax highlighting for inline code

* finish '.. default-role' and preliminary '.. role'

implementation

* more compact check in dirRole

* set :literal: as default role for *.rst

* Update lib/packages/docutils/rst.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* use whichRole for setting currRoleKind

* Update lib/packages/docutils/rst.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* rename rnGeneralRole -> rnUnknownRole

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-04-02 22:11:44 +02:00
Timothee Cour
a7bb973a24 docgen: render pragmas by default except for a select list (and fix #9074) (#17054) 2021-04-01 08:45:55 +02:00
Timothee Cour
d23a757765 fix https://github.com/nim-lang/RFCs/issues/352: show top-level import for top-level runnableExamples in generated docs (#17542)
* fix https://github.com/nim-lang/RFCs/issues/352: show top-level import for top-level runnableExamples in generated docs

* use canonical imoprt

* fix test
2021-03-29 16:25:27 +02:00
Timothee Cour
452366982d fix #16901: sidebar groups now works with all routines, not just proc,func (#17416)
* fix #16901: sidebar groups now works with all routines, not just proc,func

* fix tests
2021-03-19 07:17:09 +01:00
Andrey Makarov
02f4464058 RST heading improvements (fix #17091) (#17195) 2021-03-02 16:41:10 +01:00
Andrey Makarov
35bd39a9d0 RST: implement footnotes and citations (#16960)
* RST: implement footnotes and citations
* manual fixup of nimdoc.out.css
* remove unused code
* shorter printing code
* Update lib/packages/docutils/rst.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-02-15 14:12:40 +01:00
zetashift
fa9dc31899 fix #16885: nimdoc css warning (#16893)
* fix #16885

* Fixup nimdoc for the CSS filter change

* Use the same Nim devel versions

* Revert "Use the same Nim devel versions"

This reverts commit 8559308f9b.

* Revert "Fixup nimdoc for the CSS filter change"

This reverts commit 99ec00a4bd.

* Fixup nimdoc.out.css

Co-authored-by: zetashift <rishi2@laptop.localdomain>
2021-02-01 20:18:37 +01:00
Timothee Cour
44f672a515 fix #9102 docgen: sidebar now shows proc signatures instead of encoding (#16857) 2021-01-29 08:42:19 +01:00
Andrey Makarov
554fe8f88f conservative approach to fix #15184 (#16723) 2021-01-15 00:53:36 +01:00
Miran
40255f6721 put both funcs and procs under the same section in the documentation (#16301)
* both funcs and procs are under the same section in the documentation

* update the test
2020-12-09 10:56:28 +01:00
Sebastian Reinhard
93b6fac468 nimdoc: Initialize theme switch and pragma dots on DOMContentLoaded (#16247)
The default HTML template for nimdoc currently initializes the dark mode switch and pragma dots when the onload event is fired. But since the onload event does not fire until all external resources (images, stylesheets, fonts, etc.) have been loaded, the light theme is shown for a brief moment before the document is fully loaded, and it switches to the dark theme. This is quite jarring, especially on slower internet connections. So let's instead initialize these things on the DOMContentLoaded event, which is fired right after the document has been parsed and the initial DOM structure is ready. This means that we now display the dark mode immediately, without having to wait for external resources to load first.

For reference, see:
- https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
- https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event

I have updated the snapshot tests in `nimdoc/`, and done some manual testing of both the theme switch and the pragma dots, to confirm that this does not break anything. Please let me know if I've missed anything.
2020-12-06 10:13:19 +01:00
Miran
c0b76ef3cb fix #16164, render doc comments (#16230)
* fix #16164, render doc comments

* add a test
2020-12-02 15:36:08 +01:00
Miran
bbe49a14ae Correct all eggs (#15906)
* "eg" is a misspelled "egg", "e.g." is "exempli gratia"
* Also, "ie" is "i.e.".
2020-11-10 21:53:25 +01:00
Miran
28bbcd9d45 fix #15702, show enum fields documentation (#15792) 2020-10-30 16:30:00 +01:00
Miran
d8a6b0b04e [backport: 1.4] Better linebreaks (#15658) 2020-10-22 12:16:19 +02:00
Timothee Cour
0979524137 add Source+Edit links on top of every docgend file (#15642) 2020-10-22 10:44:28 +02:00
Andreas Rumpf
3b901d1e36 docgen: improve alignment of comments (still not perfect) (#15506)
* docgen: improve alignment of comments (still not perfect)

* fix error message text in `tunknown_named_parameter`

Co-authored-by: narimiran <narimiran@disroot.org>
2020-10-07 14:39:13 +02:00
Miran
112b11c154 group procs of the same name in TOC (#15487)
* group procs of the same name in TOC

* correctly show `sink` parameters in TOC

* no need to reinvent the wheel - `mgetorPut` exists

* better setting of text color [ci skip]

* fix CSS for better alignment
2020-10-05 17:03:14 +02:00
Manuel Bojato
04232d92cd Fix theme switch load from local storage (#14897)
* fix theme switch load from local storage

* Fix tests

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-07-10 15:06:07 +02:00
Timothee Cour
930a0c999b cleanup comment now that #14434 was fixed (#14874) 2020-07-01 14:16:22 -07:00
Timothee Cour
2867a33ebc fix #14846; add macros.extractDocCommentsAndRunnables (#14849)
* fix #14846; add macros.extractDocCommentsAndRunnables

* fixup

* update tests

* address comment
2020-07-01 09:26:23 +02:00
Timothee Cour
bb62feff72 fix #14691 docgen works again for methods (#14701)
* fix #14691 docgen methods

* fixup
2020-06-18 08:47:16 +02:00
Timothee Cour
0a27cca4b5 runnableExamples: correctly handle multiline string litterals (#14492)
* runnableExamples: correctly handle multiline string litterals

* address comments: improve doc comments + variable namings
2020-06-01 15:56:29 +02:00
Timothee Cour
e646c16e06 hotfix doc comments for procs without body (#14494) 2020-05-29 05:30:36 -07:00
Timothee Cour
579456d520 fix #14485 (#14487) 2020-05-28 19:00:36 -07:00