summary refs log tree commit diff stats
path: root/tests/stdlib/trstgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* Make rstgen work with gcsafe (#20534)ringabout2022-10-101-0/+5
| | | | | | | | | | | * Make rstgen work with gcsafe Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com> * add tests and fixes * if nimHasWarningAsError Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>
* Markdown indented code blocks (#20473)Andrey Makarov2022-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * Implement Markdown indented code blocks Additional indentation of 4 spaces makes a block an "indented code block" (monospaced text without syntax highlighting). Also `::` RST syntax for code blocks is disabled. So instead of ```rst see:: Some code ``` the code block should be written as ```markdown see: Some code ``` * Migrate RST literal blocks :: to Markdown's ones
* make more standard libraries work with `nimPreviewSlimSystem` (#20343)ringabout2022-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | * make more standard libraries work with `nimPreviewSlimSystem` * typo * part two * Delete specutils.nim * fixes more tests * more fixes * fixes tests * fixes three more tests * add formatfloat import * fix * last
* Implement Pandoc Markdown concise link extension (#20304)Andrey Makarov2022-09-041-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix auto links to subheader when TOC is present (#20279)Andrey Makarov2022-08-271-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix links to subheader when TOC is present It was observed (in https://github.com/nim-lang/Nim/pull/20112) that links to 2nd- (and subsequent) -level headings fail if TOC is present, e.g.: ```nim .. contents:: Type relations ============== Convertible relation -------------------- Ref. `Convertible relation`_ ``` The problem here is that links are resolved in `rst.nim` but later `rstgen.nim` fixes ("fixes") anchors to make them unique so that TOC always works (if e.g. there was another sub-section like "Convertible relation"). The solution implemented in this PR is to move that fix-up of anchors into `rst.nim`, so that link resolution could know final anchors. The bug seems to be added in https://github.com/nim-lang/Nim/pull/2332 in 2015, that is it is present in Nim 1.0.
* Don't require blank line before Markdown code (#20215)Andrey Makarov2022-08-151-2/+2
| | | | Fixes bug reported in https://github.com/nim-lang/Nim/pull/20189 affecting nimforum.
* Highlight Nim default in Markdown code in .nim (#20110)Andrey Makarov2022-07-311-1/+6
| | | Highlight Nim by default in Markdown code in .nim
* Markdown code blocks part 2; migrate Nim Manual (#20080)Andrey Makarov2022-07-251-1/+6
| | | | | * Change headings underscored by `~~~` to `###` * Markdown code blocks part 2; migrate Nim Manual
* Improve Markdown code blocks & start moving docs to Markdown style (#19954)Andrey Makarov2022-07-151-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* enable style:usages for stdlib tests [backport: 1.6] (#19715)flywind2022-04-131-4/+4
| | | | | | | | | | | | | | | * enable style:usages for stdlib tests * freeAddrInfo * more tests * importc * bufSize * fix more * => parseSql and renderSql
* Fix bug 27 of #17340 (#19433)Andrey Makarov2022-02-071-2/+9
| | | | | | Fixes silent disappearance of Markdown (pseudo-)link when it's detected as unsafe protocol. Now it will be converted to plain text in spirit of [the specification](https://spec.commonmark.org/0.30/#links). For that sake the check for protocol is added to rst.nim also.
* Merge pull request from GHSA-ggrq-h43f-3w7mDominik Picheta2022-01-291-7/+38
| | | | This fixes a CVE (currently https://github.com/nim-lang/Nim/security/advisories/GHSA-ggrq-h43f-3w7m)
* fixes a possible 'javascript:' protocol exploit [backport:1.0] (#19134)Andreas Rumpf2021-12-101-4/+31
| | | | | | | | | | | | | * fixes a possible 'javascript:' protocol exploit [backport:1.0] * add tests * Update tests/stdlib/trstgen.nim * add the same logic for hyperlinks * move the logic into a proc Co-authored-by: narimiran <narimiran@disroot.org>
* docgen: implement doc link resolution in current module (#18642)Andrey Makarov2021-10-281-9/+10
|
* rst: add missing line/column info for some warnings (#18383)Andrey Makarov2021-07-201-51/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* validate rst field for :number-lines:, :status: (#18304)Andrey Makarov2021-06-201-0/+12
|
* docgen: move to shared RST state (fix #16990) (#18256)Andrey Makarov2021-06-201-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* docs: Latex generation improvements (#18141)Andrey Makarov2021-06-011-2/+2
| | | | | | | * docs: improve Latex generation * make it work on Windows + fix ] escaping * minor fixes with escapes and style
* docs: make inline markup more compatible with Markdown (#18053)Andrey Makarov2021-05-211-5/+7
| | | fixes https://github.com/timotheecour/Nim/issues/739
* typo: nonexistant => nonexistent (#17918)Timothee Cour2021-05-021-2/+2
| | | | | * typo: nonexistant => nonexistent * fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
* close #16646; `since` now works with bootstrap nim post csources_v1 (#17895)Timothee Cour2021-04-301-1/+1
| | | | | | | * revive #16627 now that csources_v1 was merged * use dedent in rst.nim, refs https://github.com/nim-lang/Nim/pull/17257#discussion_r589025683 * fix test and improve rendering of a rst warning
* add RST highlighting for command line / shells (also fixes #16858) (#17789)Andrey Makarov2021-04-211-8/+12
|
* rst indentation fixes (ref #17340) (#17715)Andrey Makarov2021-04-151-1/+12
|
* restyle RST option lists (#17637)Andrey Makarov2021-04-101-12/+23
| | | | | | | | | | | | | * WIP: restyle RST option lists * apply similar style to Latex * fix tests * minor visual tweaks * update tests * remove leftover comments
* further progress on rst roles & directives (fix #17646) (#17659)Andrey Makarov2021-04-081-0/+36
| | | | | | | * further progress on rst roles & dir-s (fix #17646) * fix documents according to the messages * fix bug 17 from #17340
* fix :number-lines: regression (#17639)Andrey Makarov2021-04-051-0/+10
|
* fix rst option list at EOF (follow-up #17442) (#17638)Andrey Makarov2021-04-041-0/+2
|
* enable syntax highlighting for inline code (#17585)Andrey Makarov2021-04-021-10/+63
| | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* RST: enable parsing of prefix roles (ref #17340) (#17514)Andrey Makarov2021-03-291-0/+41
|
* fix RST parsing after option lists (#17442)Andrey Makarov2021-03-251-0/+49
|
* fix #17260 render `\` properly in nim doc, rst2html (#17315)Timothee Cour2021-03-241-2/+20
|
* Rst test check messages (fix #17280) (#17338)Andrey Makarov2021-03-171-75/+125
|
* allow short-style rst references with symbols (#17372)Andrey Makarov2021-03-171-0/+25
|
* fix RST parsing when no indent after enum.item (fix #17249) (#17257)Andrey Makarov2021-03-121-0/+9
|
* RST heading improvements (fix #17091) (#17195)Andrey Makarov2021-03-021-0/+156
|
* make rst.nim use object variant (#17138)Andrey Makarov2021-02-221-0/+5
| | | | | | | * make rst.nim use object variant * add workaround * fix mistake
* stricter checks for RST headlines (#17089)Andrey Makarov2021-02-201-4/+20
|
* RST: implement footnotes and citations (#16960)Andrey Makarov2021-02-151-0/+208
| | | | | | | | | * 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>
* parse RST headings when EOF follows them (#17014)Andrey Makarov2021-02-121-0/+7
|
* RST: implement internal targets (#16614)Andrey Makarov2021-01-111-0/+158
|
* RST: improve line blocks (#16518)Andrey Makarov2020-12-311-4/+34
|
* RST: fix directive with fields (#16490) (#16493)Andrey Makarov2020-12-291-0/+11
| | | | | | | * RST: fix directive with fields (#16490) * Update tests/stdlib/trstgen.nim Co-authored-by: Clyybber <darkmine956@gmail.com>
* use doAssert in tests (#16486)flywind2020-12-281-76/+76
|
* RST: implement admonitions (#16438)Andrey Makarov2020-12-271-0/+49
|
* RST enumlist followup (#16382)Andrey Makarov2020-12-191-3/+39
| | | | | * fix matching of enumerator #) * RST: markdown list with auto-enumerator `1`
* doc/rst2html: some few fixes for enumerated and bullet lists (#16295)Andrey Makarov2020-12-141-0/+138
| | | | | | | | | | | | * fix bullet/enumarated lists with many blank lines * fix enumerated list parsing * fix parse failure when next line after list empty * implement arbitrary start of enumerator * check that enumerators are in order * remove redundant start=x if x=1 or a * add some doc on implemented features * update start in rst_examples.rst * allow upper-case letters + more docs
* Added Python to highlite module. (#16286)Xabier Bello2020-12-081-4/+20
| | | | | | | | | | | * Added Python to highlite module. * Added the keywords for Python * Refactored the 'pythonLikeNextToken' into 'nimNextToken': - `lang` property added to GeneralTokenizer object, is set in `getNextToken`. - `nimNextToken` accepts `keywords` parameter, used for languages different from Nim. - Multiline comment available only for `langNim`.
* RST tables: fix latex col number; allow less than three of `=` (#16040)Andrey Makarov2020-12-041-4/+182
|
* move rest of tests to testament (#16140)flywind2020-11-271-1/+6
| | | | * move rest of tests to testament * Update tests/stdlib/tsums.nim
* rst: add support for markdown tables (#15854)Miran2020-11-101-0/+24
| | | | | | | * rst: add support for markdown tables * change template into proc * don't create unnecessary `seq[string]`