summary refs log tree commit diff stats
path: root/compiler/docgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* bootstrap the compiler with nimPreviewSlimSystem (#20176)ringabout2022-08-091-0/+4
| | | | | * bootstrap the compiler with nimPreviewSlimSystem * threads
* fixes #20132; fixes the broken jsondoc comand [backport] (#20135)ringabout2022-08-041-1/+2
| | | | | * fixes #20132; fixes the broken jsondoc comand * add testcase
* .forbids pragma: defining forbidden tags (#20050)Lancer112112022-07-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .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>
* Make imports/exports not be a dropdown in sidebar (#19907)Jake Leahy2022-07-161-3/+14
| | | | | | | | | * 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
* Improve Markdown code blocks & start moving docs to Markdown style (#19954)Andrey Makarov2022-07-151-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add additional parameters parsing (other implementations will just ignore them). E.g. if in RST we have: .. code:: nim :test: "nim c $1" ... then in Markdown that will be: ```nim test="nim c $1" ... ``` - implement Markdown interpretation of additional indentation which is less than 4 spaces (>=4 spaces is a code block but it's not implemented yet). RST interpretes it as quoted block, for Markdown it's just normal paragraphs. - add separate `md2html` and `md2tex` commands. This is to separate Markdown behavior in cases when it diverges w.r.t. RST significantly — most conspicously like in the case of additional indentation above, and also currently the contradicting inline rule of Markdown is also turned on only in `md2html` and `md2tex`. **Rationale:** mixing Markdown and RST arbitrarily is a way to nowhere, we need to provide a way to fix the particular behavior. Note that still all commands have **both** Markdown and RST features **enabled**. In this PR `*.nim` files can be processed only in Markdown mode, while `md2html` is for `*.md` files and `rst2html` for `*.rst` files. - rename `*.rst` files to `.*md` as our current default behavior is already Markdown-ish - convert code blocks in `docgen.rst` to Markdown style as an example. Other code blocks will be converted in the follow-up PRs - fix indentation inside Markdown code blocks — additional indentation is preserved there - allow more than 3 backticks open/close blocks (tildas \~ are still not allowed to avoid conflict with RST adornment headings) see also https://github.com/nim-lang/RFCs/issues/355 - better error messages - (other) fix a bug that admonitions cannot be used in sandbox mode; fix annoying warning on line 2711
* RST: improve simple tables (#19859)Andrey Makarov2022-06-041-0/+1
| | | | | | | * RST: improve simple tables * nim 1.0 gotchas * Still allow legacy boundaries like `----`
* Refactor and doc package handling, module name mangling (#19821)quantimnot2022-05-301-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor and doc package handling, module name mangling * Consolidate, de-duplicate and extend package handling * Alter how duplicate module names of a package are handled * Alter how module names are mangled * Fix crash when another package is named 'stdlib' (test case added) * Doc what defines a package in the manual Modules with duplicate names within a package used to be given 'fake' packages to resolve conflicts. That prevented the ability to discern if a module belonged to the current project package or a foreign package. They now have the proper package owner and the names are mangled in a consistent manner to prevent codegen clashes. All module names are now mangled the same. Stdlib was treated special before, but now it is same as any other package. This fixes a crash when a foreign package is named 'stdlib'. Module mangling is altered for both file paths and symbols used by the backends. Removed an unused module name to package mapping that may have been intended for IC. The mapping was removed because it wasn't being used and was complicating the issue of package modules with duplicate names not having the proper package owner assigned. * Fix some tests * Refactor `packagehandling` * Remove `packagehandling.withPackageName` and its uses * Move module path mangling from `packagehandling` to `modulepaths` * Move `options.toRodFile` to `ic` to break import cycle * Changed import style to match preferred style Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* Move common Latex code into class nimdoc.cls (#19734)Andrey Makarov2022-04-211-1/+5
|
* Document links repect --out in .idx file (#19543)Jake Leahy2022-02-241-1/+4
| | | | | | | * Link in .idx file now respects --out:file switch * Use clearer chained calls Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fix broken CI (#19472)flywind2022-01-311-0/+1
| | | | | | | * fix broken CI * fix * fix tests
* Merge pull request from GHSA-ggrq-h43f-3w7mDominik Picheta2022-01-291-1/+1
| | | | This fixes a CVE (currently https://github.com/nim-lang/Nim/security/advisories/GHSA-ggrq-h43f-3w7m)
* Fix group reference (with capital letters (#19196)Andrey Makarov2021-12-201-1/+2
| | | in group name)
* change os.nim doc links to new style (#19102)Andrey Makarov2021-11-081-0/+7
|
* docgen: implement doc link resolution in current module (#18642)Andrey Makarov2021-10-281-16/+138
|
* strict effects (#18777)Andreas Rumpf2021-09-021-3/+4
| | | | | | | | | | | | | | | | | * 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
* replace wrt with proper word (#18724)flywind2021-08-221-1/+1
| | | | | * what does wrt mean? * clarify
* Remove unused imports, and deprecated function usage (#18663)Kyle Brown2021-08-111-2/+2
| | | | | | | * clean up imports and slice to remove delete * revert buggy code * Replace "delete" with setlen to remove depreciation warning
* don't use plus instead of space (#18589)Miran2021-07-261-2/+2
|
* docgen: sort symbols (fix #17910) (#18560)Andrey Makarov2021-07-251-14/+84
| | | | | | | | | | | | | | * 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;`)
* rst: add missing line/column info for some warnings (#18383)Andrey Makarov2021-07-201-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rst: add missing line/column info for some warnings * add workaround * use TLineInfo/FileIndex for storing file names * fix blank lines in include file (rm harmful strip) * don't use ref TLineInfo * return `hasToc` as output parameter for uniformity * 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> * address review - stylistic things * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * unify RST warnings/errors names * doAssert + minor name change * fix a bug caught by doAssert * apply strbasics.strip to final HTML/Latex * rm redundant filename * fix test after rebase * delete `order` from rnFootnoteRef, also display errors/warnings properly when footnote references are from different files * Update compiler/lineinfos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * revert because of error: Error: cannot prove that it's safe to initialize 'info' with the runtime value for the discriminator 'kind' * Update lib/packages/docutils/rstgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * apply suggestion * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * add Table for string->file name mapping * do not import compiler/lineinfos * fix ambiguous calls Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: narimiran <narimiran@disroot.org>
* nim doc now correctly renders deprecated pragmas for routines and types (#18515)Timothee Cour2021-07-191-12/+3
|
* runnableExamples now show originating location in stacktraces on failure ↵Timothee Cour2021-07-091-6/+19
| | | | | | | | | (#18457) * runnableExamples now show originating location in stacktraces on failure * PRTEMP * fix indentation inside multiline strings
* followup #18362: make `UnusedImport` work robustly (#18366)Timothee Cour2021-06-271-1/+1
| | | | * warnDuplicateModuleImport => hintDuplicateModuleImport * improve DuplicateModuleImport msg, add test
* validate rst field for :number-lines:, :status: (#18304)Andrey Makarov2021-06-201-0/+1
|
* docgen: move to shared RST state (fix #16990) (#18256)Andrey Makarov2021-06-201-83/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* fixes #18112 (#18165)Andreas Rumpf2021-06-031-2/+4
|
* docs: Latex generation improvements (#18141)Andrey Makarov2021-06-011-1/+1
| | | | | | | * docs: improve Latex generation * make it work on Windows + fix ] escaping * minor fixes with escapes and style
* docgen: escape special characters in titles (#18014)Andrey Makarov2021-05-151-2/+3
|
* `doc2tex`: generate docs to Latex (#17997)Andrey Makarov2021-05-141-8/+14
| | | | | * `doc2tex`: generate docs to Latex * address some comments
* fixes #17675 (#17981)Andreas Rumpf2021-05-091-1/+1
|
* docgen: get rid of ropes (#17939)Andrey Makarov2021-05-051-190/+146
|
* more strict RST inline markup parsing (#17827)Andrey Makarov2021-04-291-2/+5
| | | | | * more strict RST inline markup parsing * add test for unexpected bonus * introduce `roPreferMarkdown`
* `--filenames:abs|canonical|legacyRelProj` for filenames in compiler msgs ↵Timothee Cour2021-04-211-15/+0
| | | | | | | (replaces `--listfullpaths:on|off`) (#17746) * use canonicalImport for filename_magicSauce * --filenames:abs|canonical|magic * rename: magic => legacyRelProj
* -d:nimDebug: calls doAssert false instead of quit (#17739)Timothee Cour2021-04-171-1/+1
|
* fix #17615(runnableExamples silently ignored if placed after some code) (#17619)flywind2021-04-021-15/+18
| | | Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* enable syntax highlighting for inline code (#17585)Andrey Makarov2021-04-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* docgen: render pragmas by default except for a select list (and fix #9074) ↵Timothee Cour2021-04-011-11/+11
| | | | (#17054)
* fix https://github.com/nim-lang/RFCs/issues/352: show top-level import for ↵Timothee Cour2021-03-291-9/+16
| | | | | | | | | 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
* custom integer literals (#17489)Andreas Rumpf2021-03-241-1/+1
| | | | | | | * user defined integer literals; refs #17020 * updated renderer.nim * use mlexerutils helper * imported all test cases from https://github.com/nim-lang/Nim/pull/17020 * final grammar updated
* fix #16973 ; nim doc now shows correct, canonical import name in title (#16999)Timothee Cour2021-03-231-7/+18
| | | | * nim doc now shows correct import name in title
* fix #16901: sidebar groups now works with all routines, not just proc,func ↵Timothee Cour2021-03-191-1/+1
| | | | | | | (#17416) * fix #16901: sidebar groups now works with all routines, not just proc,func * fix tests
* Rst test check messages (fix #17280) (#17338)Andrey Makarov2021-03-171-2/+7
|
* fix RST parsing when no indent after enum.item (fix #17249) (#17257)Andrey Makarov2021-03-121-2/+3
|
* fix #13491 #17279 runnableExamples now don't get lost in translation (#17282)Timothee Cour2021-03-091-23/+42
| | | | | * fix #13491 runnableExamples rendering * fix a runnableExamples thanks to this bugfix
* RST heading improvements (fix #17091) (#17195)Andrey Makarov2021-03-021-6/+10
|
* fix code-block test bugs: fix #17183, fix ↵Timothee Cour2021-02-261-1/+7
| | | | | | | https://github.com/timotheecour/Nim/issues/620 (#17184) * fix code-block test bugs: fix #17183, fix https://github.com/timotheecour/Nim/issues/620 * cleanup
* make rst.nim use object variant (#17138)Andrey Makarov2021-02-221-2/+2
| | | | | | | * make rst.nim use object variant * add workaround * fix mistake
* stricter checks for RST headlines (#17089)Andrey Makarov2021-02-201-0/+1
|
* RST: implement footnotes and citations (#16960)Andrey Makarov2021-02-151-0/+1
| | | | | | | | | * 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>
* quote nim command on compile (#16954)n5m2021-02-071-1/+1
|