https://github.com/susam/texme Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} susam / texme * Sponsor Sponsor susam/texme * Notifications * Star 1.8k * Fork 59 Self-rendering Markdown + LaTeX documents MIT License 1.8k stars 59 forks Star Notifications * Code * Issues 2 * Pull requests 1 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 2 branches 9 tags Code Clone HTTPS GitHub CLI [https://github.com/s] Use Git or checkout with SVN using the web URL. [gh repo clone susam/] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @susam susam Use light mode screenshot ... 77c09a3 Apr 25, 2021 Use light mode screenshot 77c09a3 Git stats * 111 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Add funding Nov 30, 2020 examples Add stylesheet for table element Apr 15, 2021 meta Update publish target in Makefile to 'live' Apr 25, 2021 test Switch from commonmark.js to marked.js Apr 4, 2021 .gitignore Ignore _site directory in .gitignore Apr 25, 2021 .travis.yml Remove Node v8 and add Node v11-14 to build matrix Sep 16, 2020 CHANGES.md Set version to 1.0.0 Apr 25, 2021 LICENSE.md Set version to 1.0.0 Apr 25, 2021 Makefile Set version to 1.0.0 Apr 25, 2021 README.md Use light mode screenshot Apr 25, 2021 jsdoc.json Rename "doc" to "docs" for JSDoc documentation Oct 24, 2018 package.json Set version to 1.0.1-dev Apr 25, 2021 texme.js Set version to 1.0.0 Apr 25, 2021 texme.min.js Set version to 1.0.0 Apr 25, 2021 View code TeXMe Contents Get Started CDN URLs Valid HTML5 Use TeXMe in Web Pages Style Render Markdown Without MathJax Skip Automatic Rendering on Load Set Options After Loading Content in Body Caveats Use TeXMe as a Library Install TeXMe Render Markdown and LaTeX Configuration Options Self-Hosting TeXMe Markdown Priority Environment Protect Dollar Sign in Code Protect Dollar Sign in Image Description Parsing Precedence Unlimited Variants License Support README.md TeXMe TeXMe is a lightweight JavaScript utility to create self-rendering Markdown + LaTeX documents. View Demo Build Status Coverage Status NPM Version JSDelivr Hits MIT License Twitter Contents * Get Started * CDN URLs * Valid HTML5 * Use TeXMe in Web Pages + Style + Render Markdown Without MathJax + Skip Automatic Rendering on Load + Set Options After Loading + Content in Body * Use TeXMe as a Library + Install TeXMe + Render Markdown and LaTeX * Configuration Options * Self-Hosting TeXMe * Markdown Priority Environment + Protect Dollar Sign in Code + Protect Dollar Sign in Image Description + Parsing Precedence + Unlimited Variants * License * Support Get Started Copy and paste the code below into an HTML file with .html as the extension name: Here is the output: valid-html5.html. It has a few more lines of code to ensure that this HTML5 code validates successfully at validator.w3.org. As a result, this example does not look as concise as the one in the previous section. In case you are wondering, a valid HTML5 document does not require explicit , , or the closing tags, so they have been omitted for the sake of brevity while maintaining completeness and correctness. In practice though, it is not necessary to write verbose code like this. All browsers follow the robustness principle, so they can render the shorter example in the Get Started section just fine. Use TeXMe in Web Pages Style TeXMe renders the document on a white pane against a gray background by default. This is due to a configuration option named style that is set to 'viewer' by default. To render the document with a minimal style on a completely plain white background, set the style configuration option to 'plain'. Here is an example:
Here is the output: skip-render.html. Set Options After Loading When we load TeXMe with the
Here is the output: set-options.html. Content in Body If you do not like to start your document with HTML tags, you can write your content first and add the Here is the output: content-in-body.html. Although, the code looks neater in this example, there is a limitation associated with this form of writing content: Since the content is part of the HTML element (there is no 3. Now, open euler.html with a web browser and it should self-render fine. All resources will be loaded from the local disk. 4. Now test euler.html by serving it via a web server. Assuming Python 3 is installed, here is one really easy way to test it: python3 -m http.server Then open https://localhost:8000/euler.html using a web server. The network tab in the browser's developer tools should show that all resources are loaded from the same web server and no requests to any other server are made. Markdown Priority Environment TeXMe provides a special LaTeX-like environment named md. This is the markdown priority environment. We will see what this term means in the next section. Let us first see what this environment does by looking at a few examples of when this special environment can be useful. TeXMe introduces the special purpose md environment to protect portions of Markdown content from being interpreted as LaTeX. In most documents, the use of this environment is not required. This environment is useful only in a handful of scenarios where a Markdown element like code span, code block, link, image, etc. may contain content with LaTeX delimiters that may get interpreted as LaTeX by TeXMe thereby leading to a broken rendering of the Markdown element. This environment protects the content of one or more Markdown elements from being interpreted as LaTeX. Let us see a few examples in the next two subsections. Protect Dollar Sign in Code The md environment is useful when Markdown code spans or code blocks contain LaTeX delimiters. This environment prevents the content of Markdown code spans and code blocks from being interpreted as LaTeX. Here is an example: