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 language cell-magic highlighting to more exports #586

Merged
merged 7 commits into from May 15, 2017

Conversation

Projects
None yet
2 participants
@mpacer
Copy link
Member

mpacer commented May 13, 2017

LaTeX exporter had the ability to inherit cell magics, but nothing was actually being done to enable that in the template because it wasn't passing the cell metadata.

@Carreau

@mpacer mpacer changed the title add code cell magic highlighting to latex add language cell-magic highlighting to more exports May 14, 2017

{%- if 'magics_language' in cell.metadata -%}
, {{ cell.metadata.magics_language}}
{%- elif 'pygments_lexer' in nb.metadata.get('language_info', {}) -%}
, {{ nb.metadata.language_info.pygments_lexer }}

This comment has been minimized.

@takluyver

takluyver May 15, 2017

Member

Is asciidoc usually rendered by something using pygments for highlighting? We do this for rst because we know that the main processor of rst, docutils, uses pygments. But if it's likely to be processed by another tool, we shouldn't give special status to the pygments highlighter name.

This comment has been minimized.

@mpacer

mpacer May 15, 2017

Author Member

Yes, asciidoc is usually rendered using pygments for highlighting.

{%- if 'magics_language' in cell.metadata -%}
{{ cell.metadata.magics_language}}
{%- elif 'pygments_lexer' in nb.metadata.get('language_info', {}) -%}
{{ nb.metadata.language_info.pygments_lexer }}

This comment has been minimized.

@takluyver

takluyver May 15, 2017

Member

I don't think markdown is usually rendered by something using pygments for highlighting, so we shouldn't be giving priority to the pygments lexer name here.

@takluyver

This comment has been minimized.

Copy link
Member

takluyver commented May 15, 2017

Other than those comments, 👍

@mpacer

This comment has been minimized.

Copy link
Member Author

mpacer commented May 15, 2017

Asciidoc seems to be based on pygments as well: http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#source-code

As far as markdown goes, what was previously there was what we use for the main language identity inside the notebook.

My only thought is that pandoc is expecting to see not pygments but skylighting language names, and that github is using Linguist and I don't know how compatible those three are. I could imagine markdown being transformed into any of the three… my gut is to go with pygments because we are a python based tool and let people who have issues come to us and we make changes as needed.

@mpacer

This comment has been minimized.

Copy link
Member Author

mpacer commented May 15, 2017

Created this stackexchange question in order to see if there's any community knowledge that we can tap into.

@takluyver

This comment has been minimized.

Copy link
Member

takluyver commented May 15, 2017

OK, this looks good to me, then.

@takluyver takluyver merged commit b5771a4 into jupyter:master May 15, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mpacer mpacer deleted the mpacer:respect_code_cell_magic branch May 15, 2017

@mpacer mpacer added this to the 5.2 milestone May 24, 2017

@mpacer mpacer added to_changelog and removed to_changelog labels May 24, 2017

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