Skip to content
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

Add documentation and unit tests for Markdown code blocks #221

Merged

Conversation

lpsinger
Copy link
Contributor

@lpsinger lpsinger commented Sep 6, 2023

Fixes #220.

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I never run this on Markdown so I have a newbie question, why "pycon" and not "python"? I associate "pycon" with the conference, not the language. 😸

I won't merge yet in case @bsipocz wants to review.

@lpsinger
Copy link
Contributor Author

lpsinger commented Sep 6, 2023

I never run this on Markdown so I have a newbie question, why "pycon" and not "python"? I associate "pycon" with the conference, not the language. 😸

'python' is syntax highlighting for Python code, whereas 'pycon' is for transcripts of Python interpreter sessions --- it highlights the prompts and output appropriately.

pytest-doctestplus doesn't care about the highlighting language; it would work just the same with either.

@drammock
Copy link

drammock commented Sep 6, 2023

why "pycon" and not "python"?

@pllim think "Python Console" and it's easier to remember.

@bsipocz
Copy link
Member

bsipocz commented Sep 6, 2023

Thank you @lpsinger!

@bsipocz bsipocz merged commit d7c1f02 into scientific-python:main Sep 6, 2023
@lpsinger lpsinger deleted the markdown-fenced-code-blocks branch September 6, 2023 20:26
@pllim
Copy link
Contributor

pllim commented Sep 9, 2023

FWIW at least on GitHub, I still find "python" nicer than "pycon" even with the console stuff. Am I using it wrong?

python

>>> import numpy as np
>>> from astropy.table import QTable
>>> c = QTable.Column(np.array([1,2,3]), unit=u.mas / u.yr, name='c')
>>> d = QTable.Column(np.array([4,5,6]), unit=u.mas, name='d')
>>> c / d
<Column name='c' dtype='float64' unit='mas / yr' length=3>
0.25
 0.4
 0.5
>>> c.data / d.data
array([0.25, 0.4 , 0.5 ])
>>> c.unit / d.unit
Unit("1 / yr")

pycon

>>> import numpy as np
>>> from astropy.table import QTable
>>> c = QTable.Column(np.array([1,2,3]), unit=u.mas / u.yr, name='c')
>>> d = QTable.Column(np.array([4,5,6]), unit=u.mas, name='d')
>>> c / d
<Column name='c' dtype='float64' unit='mas / yr' length=3>
0.25
 0.4
 0.5
>>> c.data / d.data
array([0.25, 0.4 , 0.5 ])
>>> c.unit / d.unit
Unit("1 / yr")

@lpsinger
Copy link
Contributor Author

lpsinger commented Sep 9, 2023

FWIW at least on GitHub, I still find "python" nicer than "pycon" even with the console stuff. Am I using it wrong?

You do you, @pllim :-)

I think it's rendering the >>> as operators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to test Markdown documents
4 participants