-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
follow-up #18013 - inline syntax highlighting #18166
Conversation
|
||
```nim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so when can i use
```nim
some code...
```
(which brings us closer to markdown, which is good) ? can any instead of
.. code-block:: cmd
some code...
be replaced or are there conditions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always, they are equivalent. You can write ```cmd and ```nim and any other language.
However note bug 22 from #17340. When it's resolved we can convert to using this Markdown style as a unified style in this repo just as you wanted.
There is 1 thing that I don't like about Markdown style: addition of those spaces at the beginning of lines. It would be good to visually distinguish code lines in documentation by additional indentation without adding them into final document.
I'd prefer to pass the code block between ``` through dedent
. WDYT?
(That does not comply to Markdown spec but it seems as a reasonable default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I found in the specification
https://spec.commonmark.org/0.29/#fenced-code-block
If the leading code fence is indented N spaces, then up to N spaces of indentation are removed from each line of the content (if present).
And this does actually work in Github:
```
some code
```
some code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool;
can you explain 22?
this seems to render fine with nim doc, doesn't it?
proc main*()=
##[
foo1:
```nim
echo 1
```
* foo2:
```nim
echo 2
```
]##
main()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add e.g. two additional spaces as indentation before echo 1
or echo 2
. And they will disappear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filed bug 23 in the same place :-)
This should be the final PR for enabling inline highlighting in standalone
rst
files.