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

Non python code still converted to a python code cell #6

Closed
thomas-saigre opened this issue Feb 23, 2023 · 2 comments
Closed

Non python code still converted to a python code cell #6

thomas-saigre opened this issue Feb 23, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@thomas-saigre
Copy link
Contributor

If I add these line of code in the adoc file :

[source, c++]
----
int main()
{
    return 0;
}
----

the exported notebook contains a Python cell, with the c++ code inside
image

Would it be possible to make a markdown code, where the content of the cell is a markdown version of the given c++ code ? (and more generally for all the other languages than python if we want to export a Python notebook)

@ggrossetie
Copy link
Member

ggrossetie commented Feb 26, 2023

That's a good point!
Yes we can, currently we convert any listing blocks but we can retrieve the language attribute and do something different:

if (nodeName === 'listing') {
const lines = node.lines
const length = lines.length
const source = lines
.map((l, index) => length === index + 1 ? l : l + '\n')
return [{
cell_type: 'code',
execution_count: 0,
metadata: {
slideshow: {
slide_type: 'fragment'
}
},
outputs: [],
source
}]
}

Feel free to submit a pull request.

@ggrossetie ggrossetie added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 26, 2023
ggrossetie pushed a commit that referenced this issue Mar 1, 2023
seems to be working on a handcrafted example but still, tests need to be fixed

/cc @ggrossetie
@ggrossetie
Copy link
Member

resolved in #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants