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

Audit of Features missing in JupyterBook #189

Open
29 of 69 tasks
rowanc1 opened this issue Feb 7, 2023 · 6 comments
Open
29 of 69 tasks

Audit of Features missing in JupyterBook #189

rowanc1 opened this issue Feb 7, 2023 · 6 comments

Comments

@rowanc1
Copy link
Member

rowanc1 commented Feb 7, 2023

Although mystmd and JupyterBook/sphinx are targeted at slightly different use-cases, there is overlap in creating websites (see background). Below is a list of missing features/directives/roles/ui that are not yet implemented in mystmd, we hope to have parity at the rendering level first, then move on to extensibility (see #181 as a major step).

We will try to keep this updated as we audit more jupyterbooks.

Directives

Roles

Config

  • edit_page_button, repository button, issues_button
  • ... audit the _config.yml
  • read the relevant parts of the _config.yml for sphinx

Extensibility

See #181 as a roadmap.

Execution

Improvements

UI

URL:

Export

@jan-david-fischbach
Copy link
Contributor

@rowanc1 To implement a feature on this list we need to simultaneously consider LaTeX and the Web output, correct? How could we go about sidebar/margin content? Using \minipage or similar does not really float my boat. At the moment I would be in favor of adding the sidebar content to the appendix, or to add it below the current paragraph as a content box.
What do you think?

@rowanc1
Copy link
Member Author

rowanc1 commented Aug 1, 2023

It would certainly be appreciated to consider both html, latex and other exports, however, we can take contributions that get us there in a few iterations. The default falls back to rendering the child content, so it is just inline in the document. I think this might depend on what template you use and as you suggest, there isn't really a good default in latex!

If you are interested in implementing one of these features, can you open a specific issue on it? We can help give some guidance on where to look and how to get started!!

@jan-david-fischbach
Copy link
Contributor

jan-david-fischbach commented Aug 1, 2023

Maybe I'll find some time to work on the sidebar soon. Trying to come up with a workaround I noticed that html tags are not left unchanged:
grafik

The myst-spec doesn't seem to say anything on how raw html is to be treated. The cheatsheet (which seems to be jb-flavoured myst) seems to indicate that html is interpreted as is.

Edit:
It seems that one can set some allowDangerousHtml flag somewhere. I just don't know where yet

@rowanc1
Copy link
Member Author

rowanc1 commented Aug 2, 2023

I have opened and linked #516 with a few pointers to start, just ping me if you start working on it and get stuck and I can try to help out fast!

There is an outstanding bug for the HTML here:

It works fine when the round-trip is HTML (e.g. using the underlying js libraries), but our renderer is react, so we actually need the AST of the HTML correct, which is currently incorrect and not nested properly. For example, this AST of bold is [html, text, html] rather than [html > text] or converted to [strong > text] in this simple case. This is still going to be a bit of work to sort through.

@jan-david-fischbach
Copy link
Contributor

Even with the "wrong" AST1 one seems to produce correct html with the allowDangerousHtml option:

import { u } from 'unist-builder';
import { mystToHtml } from 'myst-to-html';

let ast = u('root', [u('html', '<b>'), u('text', 'test'), u('html', '</b>')]);

const skewed_html = mystToHtml(ast);
console.log(skewed_html); // test

const html = mystToHtml(ast, {'hast': {'allowDangerousHtml': true}, 'stringifyHtml': {'allowDangerousHtml': true}});
console.log(html); // <b>test</b>

Footnotes

  1. The correct handling of html doesn't seem to be firmly defined: Does it all go into one html node, or using children for the content. How is markdown syntax inside html handeled etc.

@rowanc1
Copy link
Member Author

rowanc1 commented Aug 2, 2023

Yes, it will work for explicit HTML outputs which is string concatenation! However most of the tools are built on React, which operates on the AST and will try to create <b> as HTML, then 'test' text, then </b>. Which will end up with <b></b>test as the first node closes by default and the closing node isn't rendered. I think it is a bit worse actually as it looks like there is an extra paragraph, <b>test</b> turns into:

image

Not great, and something to fix up soon (#418)!

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

No branches or pull requests

2 participants