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
KaTeX website & documentation #1484
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1484 +/- ##
======================================
Coverage 84.1% 84.1%
======================================
Files 79 79
Lines 4561 4561
Branches 804 804
======================================
Hits 3836 3836
Misses 630 630
Partials 95 95 Continue to review full report at Codecov.
|
Super cool! I'll make a pull request to this branch that cleans up errors in the function support page. |
[skip ci]
[skip ci]
@ronkok Please feel free to commit directly to the branch 😄 |
@ylemkimon this is awesome! I checked out the test site and it looks super cool. I'm also very happy that our docs are going to be in |
@ylemkimon it isn't necessary to complete everything in the checklist before we merge this. I would prefer to merge this sooner and iterate on it. It'll keep the PR size down and once it's merged other people can help out. 🙂 |
docs/supported.md
Outdated
--- | ||
This is a list of TeX functions supported by KaTeX. It is sorted into logical groups. | ||
|
||
There is another version of this page, [with working examples](https://khan.github.io/KaTeX/function-support.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably just link to this page for now and then move this page to into the repo and style it appropriately. Apparently docusaurus has a way to wrap HTML pages so that they look like they're part of the site. https://docusaurus.io/docs/en/custom-pages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or as Markdown
is superset of HTML, I think we can just copy its contents for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give me a couple of days before you take any drastic action.. I'll see what I can do with the docosaurus page. Either way, it will be good to have only one page to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ylemkimon I'd like the function support page to have some tables styled differently than the GFM markdown tables now shown. For example, many of the tables should have no <thead>
row. I like your idea of copying at least some of the current function support page into this documentation.
If I add some classes to website/static/static/index.css
, can I then use those class names to style elements in the supported.md
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering my own question: docusaurus docs addresses this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronkok website/static/static/index.css
is for the main page(index.html
), and for the styles needed in documentations, you can put them in the website/static/css/custom.css
or another .css
file in website/static/css
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave a redirect link at https://khan.github.io/KaTeX/function-support.html that will forward to the new documentation? That existing page is fairly high in the search engine results for "katex".
], | ||
|
||
// If you have users set above, you add it here: | ||
users, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this gets passed to the Users
component defined in users.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinbarabash Yes, any property can be exported through siteConfig
and used in other components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! It seems like docusaurus is quite flexible.
const CompLibrary = require('../../core/CompLibrary.js'); | ||
const Container = CompLibrary.Container; | ||
|
||
const siteConfig = require(process.cwd() + '/siteConfig.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a relative path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinbarabash These files are copied to node_modules/docusaurus
at the build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Can you add a comment about this.
}); | ||
|
||
return ( | ||
<div className="mainContainer"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KA uses aphrodite
for CSS in JS styling. That's something we may want to adopt in the future.
@@ -0,0 +1,14 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, we're a monorepo now.
* Katex package. | ||
*/ | ||
module.exports = function(md, options) { | ||
var katex = require("../"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
||
/** | ||
* Plugin for Remarkable Markdown processor which transforms $..$ and $$..$$ sequences into math HTML using the | ||
* Katex package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no npm package for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinbarabash There is remarkable-katex
. But we don't have control over the version of KaTeX it uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
}], | ||
|
||
scripts: ['https://buttons.github.io/buttons.js'], | ||
stylesheets: ['https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use the local katex.js
in some places bu the CSS
on a CDN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinbarabash katex.js
is used at the build time, specifically when parsing the markdown, whereas CSS is included in the build result. But now I think, there may be discrepancies between the last release version and the master
branch. We probably should copy the CSS from local KaTeX build.
height: 80%; | ||
} | ||
|
||
@media only screen and (min-device-width: 360px) and (max-device-width: 736px) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinbarabash This file was provided by docusaurus
as a boilerplate. I think we can remove them, if we don't have any custom styles to apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can leave then and fill them in if/when we make the site responsive.
The travis-ci build completed successfully. I've restarted it manually and hopefully that will fix things here. |
This is new... I haven't see |
In this case, I'm not going to bother since the circleci checks are mandatory... yet. |
@kevinbarabash There were couple of instances of CircleCI Chrome build failing, that I'd to rerun manually. As the problems are limited to Chrome builds, I think it's not a CircleCI issue, but a Selenium issue and upgrading its version might fix the problems. |
How is this going to (auto?) build? Is the idea to Regarding the checklist: once this gets merged, we could move the un-checked-off items into an issue. Overall, very exciting! |
@edemaine Yes. Also, docusaurus provides |
@ylemkimon I have not been able to build a local version of the documentation. And yet I have made a substantial revision to the function support page. I don't know exactly how it all will look, but I'm pretty sure that I've eliminated most of the rendering errors. If you get a change to rebuild this branch, I'll take another look. I expect that another draft will be necessary. In a couple of places I used HTML tables instead of markdown tables and I don't know yet how they will turn out. |
@ronkok You can test the website by: cd website
yarn install # or npm install
yarn start # or npm start |
Well yes, I already ran the commands that you suggest. Long range debugging is tedious, I know, but if you wish to try, the error message I get is:
|
I now have a an markdown version of the function support page ready. I'll upload it later when I have better network access. In the new version there is both good and bad. Good part: As a pre-rendered static file, it runs wicked fast. Bad part: The auto-renderer has issues where it does not properly interpret characters between
I've tried a couple different escape character tactics but have had no success. I've tried putting content into HTML tables instead of GFM pipe tables, but inside those HTML tables neither the If anyone knows a way to get escape characters that work, let me know. |
I've made a general edit to the function support page. There are still a few markdown quirks that I haven't been able to overcome, such as excess padding in the environment table. Even with those quirks, it's a pretty good effort. And I love the rendering speed. |
Is the plan to deploy to |
I see, it looks like |
@ronkok what about |
By the way, now that KaTeX is its own organization, I believe we could also publish a website from a separate repo. Not sure whether there are particular advantages either way. |
I'm not sure what you have in mind. If you are thinking that perhaps we could use |
@ronkok it sounds like the issue is our auto-render extension. I assume other Markdown engines are parsing things along |
@edemaine one of the downsides of hosting the docs in a separate repo is that it makes testing the docs against changes more difficult. I was also hoping that we might someday might have our test page live in the docs as well. |
The auto-render code is in the And you are right about nesting, too. The parser cannot deal with nested I've found a couple sneaky workarounds for the "|" characters inside tables, using |
.. except for the |
Yes, the normal KaTeX auto-render extension is good at handling nested |
👍 sounds like a plan. |
Let's not not let this nested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM I'm excited about this new direction for our documentation.
Fixes zulip#10091. `https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX` has been moved from the wiki to the docs at https://khan.github.io/KaTeX/docs/supported.html in KaTeX/KaTeX#1484.
Fixes #10091. `https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX` has been moved from the wiki to the docs at https://khan.github.io/KaTeX/docs/supported.html in KaTeX/KaTeX#1484.
Fixes zulip#10091. `https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX` has been moved from the wiki to the docs at https://khan.github.io/KaTeX/docs/supported.html in KaTeX/KaTeX#1484.
Uses docusaurus, which is a markdown-based static documentation site generation tool. Run
yarn start
to start test server andyarn build
to build the site.Test site: https://ylemkimon.github.io/KaTeX/ (You can access the documentation by clicking
Installation
orDocumentation
,Note: this is not an official documentation of KaTeX
is inserted to distinguish from official documentation)Related: #1330
Fixes #1483