Skip to content

will add a preprocessor here (ready to merge) #31

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

martinlarsalbert
Copy link

@martinlarsalbert martinlarsalbert commented Apr 21, 2021

Will add a preprocessor that enables
(removing-pieces-of-cells-using-cell-tags)[https://nbconvert.readthedocs.io/en/latest/removing_cells.html#removing-pieces-of-cells-using-cell-tags].
fixes #30

@martinlarsalbert martinlarsalbert changed the title will add a preprocessor here (not ready to merge) will add a preprocessor here (ready to merge) Apr 30, 2021
@martinlarsalbert
Copy link
Author

I've now tested this feature and it seems to be working. I think that this is usefull feature, that is now ready for merge.

@mjam03
Copy link
Collaborator

mjam03 commented Nov 11, 2021

Hi Martin,

Sorry for the delay in response. Ted's let me help with contributing to the repo and I've just started going through the issues. I love the idea of some way to customise which code shows and which code doesn't, particularly when you've just a big long block that is required but doesn't add anything to a medium article.

I had a similar issue where the medium code highlighting is terrible so I added an option to 'gistify' code blocks so that they automatically get linted gists created and entered in the article.

Given that I've merged that pull request (which means this one needs updated), I'll do the work to pull this branch down and update it.

Obviously everyone writes different articles with different content - I'm not sure by default omitting all code blocks is something we want. Would you be happy with something along the lines of the following implementation that would show up in the html form for configuration:

  • "Use cell tags": Boolean switch to decide whether or not cell tags are respected as you have explained. If set to true then default behaviour would be to remove all code blocks that don't have show as a cell tag
  • "Gistify": This is the feature I have added - a boolean saying whether or not you want the remaining code cells to be made into nicely linted gists.
  • "Gist Threshold": Integer value that defaults to 5 - the length of code block in lines above which to convert to gists (this can obviously be set to zero to make all code blocks gists). The aim here was to give some flexibility to prevent gist-ing 1-liner snippets of code that could just be inserted as markdown in Medium

What do you think? I think there is then one missing piece which is 'total flexibility' i.e. the ability to determine for every code block:

  • whether or not you want it to show
  • whether or not you want it gist-ed

but I think the above setup would be a nice middle ground given that everyone uses this for various uses - some are more code heavy articles compared to more articles where the code is used to generate images more.

Mark

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

Successfully merging this pull request may close these issues.

removing-pieces-of-cells-using-cell-tags
2 participants