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 your favorite code example to our syntax highlight doc #22

Open
lornajane opened this issue Sep 11, 2020 · 6 comments
Open

Add your favorite code example to our syntax highlight doc #22

lornajane opened this issue Sep 11, 2020 · 6 comments
Labels
good first issue Good for newcomers

Comments

@lornajane
Copy link
Contributor

We have an example project with some code in it, showing off syntax highlight (see https://rst2pdf.org/examples under "Code Samples" ) and it is also useful for testing different pygments themes.

If you write a programming language that is not included in the doc, we would love a PR of 10-30 lines of code in a new section to show it off (and check it works!)

@lornajane lornajane added the good first issue Good for newcomers label Sep 11, 2020
@lornajane lornajane changed the title Add more tech stacks to the syntax highlight example Add your favorite code example to our syntax highlight doc Oct 2, 2020
@dufcrule
Copy link
Contributor

dufcrule commented Oct 8, 2020

I've added a new code example to the doc and when I run Jekyll I can see the change in the code1.rst file, but I'm not 100% sure how to generate the PDF to check what it looks like 😅 .

@lornajane
Copy link
Contributor Author

Don't worry. If you want to see it, there's an example command with the sample PDF https://rst2pdf.org/examples#code-samples - something like rst2pdf code1.rst will give you some default-styled output.

@dufcrule
Copy link
Contributor

dufcrule commented Oct 8, 2020

Hmm... I can't seem to get the rst2pdf command to work. I'm running Python 3.8.1 and I installed rst2pdf from GitHub following the instructions (I'm using a Mac). That all went OK but when I run the rst2pdf command I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/rst2pdf", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jinja2' distribution was not found and is required by rst2pdf

Look like it's something to do with with my Python config. Although I'm running v3.8.1, it seems like it's trying to use v2.7.

Apologies for being a newbie. I've used LaTeX and Pandoc before to generate PDFs, but wanted to see if I could get this 'new' way to work!

Scratch that. Managed to fix it using sudo python3 setup.py install instead of sudo python setup.py install and it now works a treat! I'll try and add the PDF to the original PR.

@dufcrule
Copy link
Contributor

dufcrule commented Oct 8, 2020

I've added the PDF now to #24. Loving this tool!

I notice there's a bit of discrepancy in the installation instructions in the README compared to those on https://rst2pdf.org/. Would it be useful to update these to make them more consistent? Perhaps the sudo python3 setup.py install command, which is where I came unstuck, could be added too? Happy to help out if you think it's necessary.

@lornajane
Copy link
Contributor Author

Yes please go ahead and update our install instructions. Not every platform uses python3 as their command but we should definitely note it as an option. That would be great, thanks!

@dufcrule
Copy link
Contributor

dufcrule commented Oct 9, 2020

Sure! I've added a note here about python3: #25. I'll have a go at adding something to the README too when I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants