Andrey Makarov
40e0048a50
Highlight Nim default in Markdown code in .nim ( #20110 )
...
Highlight Nim by default in Markdown code in .nim
2022-07-31 15:38:00 +02:00
Andrey Makarov
62b81d7f10
Markdown code blocks part 2; migrate Nim Manual ( #20080 )
...
* Change headings underscored by `~~~` to `###`
* Markdown code blocks part 2; migrate Nim Manual
2022-07-25 18:29:52 +02:00
Andrey Makarov
417b90a7e5
Improve Markdown code blocks & start moving docs to Markdown style ( #19954 )
...
- 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
2022-07-15 19:27:54 +02:00
flywind
98cebad7de
enable style:usages for stdlib tests [backport: 1.6] ( #19715 )
...
* enable style:usages for stdlib tests
* freeAddrInfo
* more tests
* importc
* bufSize
* fix more
* => parseSql and renderSql
2022-04-13 11:53:02 +02:00
Andrey Makarov
801c0f0369
Fix bug 27 of #17340 ( #19433 )
...
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.
2022-02-07 18:11:53 -05:00
Dominik Picheta
cb894c7094
Merge pull request from GHSA-ggrq-h43f-3w7m
...
This fixes a CVE (currently
https://github.com/nim-lang/Nim/security/advisories/GHSA-ggrq-h43f-3w7m )
2022-01-29 14:03:01 +01:00
Andreas Rumpf
9338aa2497
fixes a possible 'javascript:' protocol exploit [backport:1.0] ( #19134 )
...
* 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 >
2021-12-10 09:24:20 +01:00
Andrey Makarov
7ba2659f73
docgen: implement doc link resolution in current module ( #18642 )
2021-10-28 19:20:52 +02:00
Andrey Makarov
8c7ee96457
rst: add missing line/column info for some warnings ( #18383 )
...
* 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 >
2021-07-20 08:32:22 +02:00
Andrey Makarov
1b3c0f142d
validate rst field for :number-lines:, :status: ( #18304 )
2021-06-20 20:00:42 +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
Andrey Makarov
ba3ec7b049
docs: Latex generation improvements ( #18141 )
...
* docs: improve Latex generation
* make it work on Windows + fix ] escaping
* minor fixes with escapes and style
2021-06-01 20:47:23 +02:00
Andrey Makarov
9f7e2e3057
docs: make inline markup more compatible with Markdown ( #18053 )
...
fixes https://github.com/timotheecour/Nim/issues/739
2021-05-21 06:54:20 +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
3192995ac9
close #16646 ; since now works with bootstrap nim post csources_v1 ( #17895 )
...
* 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
2021-04-30 18:54:47 +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
f8dce493d3
rst indentation fixes (ref #17340 ) ( #17715 )
2021-04-15 08:12:44 +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
Andrey Makarov
42687457b0
further progress on rst roles & directives ( fix #17646 ) ( #17659 )
...
* further progress on rst roles & dir-s (fix #17646 )
* fix documents according to the messages
* fix bug 17 from #17340
2021-04-08 19:00:14 +02:00
Andrey Makarov
ca405167ed
fix :number-lines: regression ( #17639 )
2021-04-05 08:33:06 +02:00
Andrey Makarov
f02e159b56
fix rst option list at EOF (follow-up #17442 ) ( #17638 )
2021-04-04 11:54:26 -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
Andrey Makarov
861c42c258
RST: enable parsing of prefix roles (ref #17340 ) ( #17514 )
2021-03-29 18:32:49 +02:00
Andrey Makarov
46364e63cd
fix RST parsing after option lists ( #17442 )
2021-03-25 08:15:05 +01:00
Timothee Cour
1590d14575
fix #17260 render \ properly in nim doc, rst2html ( #17315 )
2021-03-24 10:58:29 +01:00
Andrey Makarov
4bfc5a9551
Rst test check messages ( fix #17280 ) ( #17338 )
2021-03-17 20:13:04 +01:00
Andrey Makarov
144e338abb
allow short-style rst references with symbols ( #17372 )
2021-03-17 18:08:13 +01:00
Andrey Makarov
d97bf4f1c8
fix RST parsing when no indent after enum.item ( fix #17249 ) ( #17257 )
2021-03-12 08:33:21 +01:00
Andrey Makarov
02f4464058
RST heading improvements ( fix #17091 ) ( #17195 )
2021-03-02 16:41:10 +01:00
Andrey Makarov
fab1618eb4
make rst.nim use object variant ( #17138 )
...
* make rst.nim use object variant
* add workaround
* fix mistake
2021-02-22 11:00:31 +01:00
Andrey Makarov
d1fec552d0
stricter checks for RST headlines ( #17089 )
2021-02-20 18:01:45 +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
Andrey Makarov
8053ccde2f
parse RST headings when EOF follows them ( #17014 )
2021-02-12 15:08:09 +01:00
Andrey Makarov
fd5c8ef208
RST: implement internal targets ( #16614 )
2021-01-11 19:51:04 +01:00
Andrey Makarov
5984f7a7dd
RST: improve line blocks ( #16518 )
2020-12-31 11:20:04 +01:00
Andrey Makarov
e70ac0f34c
RST: fix directive with fields ( #16490 ) ( #16493 )
...
* RST: fix directive with fields (#16490 )
* Update tests/stdlib/trstgen.nim
Co-authored-by: Clyybber <darkmine956@gmail.com >
2020-12-29 03:32:11 +01:00
flywind
6d442a40a6
use doAssert in tests ( #16486 )
2020-12-28 14:13:21 +01:00
Andrey Makarov
2bdc479622
RST: implement admonitions ( #16438 )
2020-12-27 11:16:12 +01:00
Andrey Makarov
9674eb3ca6
RST enumlist followup ( #16382 )
...
* fix matching of enumerator #)
* RST: markdown list with auto-enumerator `1`
2020-12-19 10:33:10 +01:00
Andrey Makarov
e843492b13
doc/rst2html: some few fixes for enumerated and bullet lists ( #16295 )
...
* 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
2020-12-14 18:10:39 +01:00
Xabier Bello
4c533b2d92
Added Python to highlite module. ( #16286 )
...
* 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`.
2020-12-08 10:44:07 +01:00
Andrey Makarov
6877e0c8a3
RST tables: fix latex col number; allow less than three of = ( #16040 )
2020-12-04 08:50:17 +01:00
flywind
bc1db0d6f1
move rest of tests to testament ( #16140 )
...
* move rest of tests to testament
* Update tests/stdlib/tsums.nim
2020-11-27 20:47:49 +01:00
Miran
ee78d76108
rst: add support for markdown tables ( #15854 )
...
* rst: add support for markdown tables
* change template into proc
* don't create unnecessary `seq[string]`
2020-11-10 09:41:26 +01:00
Miran
1494d88fa2
rst: parse brackets individually, fixes #10475 ( #10997 )
2019-04-10 15:55:57 +02:00
Arne Döring
9c2365d5c2
activated more tests, allow input in test spec
2018-11-23 11:58:28 +01:00
Felix Krause
6fe916fc77
Fixes to YAML highlighting support, added tests
2016-04-01 21:35:46 +02:00