Comments (14)
Don't we have one of those javascript highlighting tools that accept either textmate or pygments source files?
from ex_doc.
It's a decent bit of work. Serendipitously Josh Adams is working on highlight.js support for Elixir.
Basic highlight.js integration should be simple enough.
from ex_doc.
Awesome! For me something like highlight.js
would be the easiest to bundle into ExDoc.
from ex_doc.
Oh yeah highlight.js
is a great option.
I'll try to put this together once this pull request gets merged: highlightjs/highlight.js#317 Thanks for working on this @knewter.
from ex_doc.
Fantastic job @knewter! β€οΈ π π π π
from ex_doc.
Any chance we could use pygments
(if it is installed on the user's system)?
from ex_doc.
That's one option, there is another issue though: how can we guarantee it is elixir syntax since we don't tag languages?
from ex_doc.
We can set default language for all code blocks. Pygments could also guess the language by contents.
from ex_doc.
Also, there has to be an option of cancelling highlighting if an error token is found. I saw this behaviour in sphinx. So we set elixir for all code blocks, but if there is a shell code example (containing $), the dollar will not be recognized by the elixir lexer, and the whole code block will be left unhighlighted.
from ex_doc.
Just for the record: adding support for pygments at the current stage would be rather complicated. To make it work for sundown and pandoc, we'd need to scan the resulting html and replace code blocks in it.
Using markdown converter written in Elixir with support for user-supplied filters would be best.
So currently, the most pragmatic approach is to bring highlight.js up to date with modern Elixir and use that. /cc @knewter
from ex_doc.
As far as I understand one could use pandoc (if installed) to take care of any syntax highlighting by setting the flag
--indented-code-classes=CLASSES
Specify classes to use for indented code blocksβfor example, perl,numberLines or haskell. Multiple classes may be separated by spaces or commas.
to elixir
and adding elixir support to pandoc / highlighting-kate. For that reason I've started working on doing exactly that:
dignifiedquire/highlighting-kate@1955130
It's not ready for prime time yet, but I hope to have something reasonable in the next few days.
from ex_doc.
If I understand correctly, this should be now solved since ex_doc is using highlight.js (with Elixir support) to highlight code examples in the documentation. Should we close this?
from ex_doc.
Yep good call. Here's the relevant PR: #168
Thanks for following up @whatyouhide.
from ex_doc.
@vanstee no problem, my pleasure!
from ex_doc.
Related Issues (20)
- Style issues after version 0.30.4 HOT 3
- Can i add Restaurant landing page using React?
- Mix Docs Build faill HOT 16
- Visual readability of sidebar tabs HOT 19
- Ensure `m::lists` (or `m:Mod`) always works in Elixir (or emits a warning)
- ex_doc > 0.30.5 generating incorrect HTML output for ex_money HOT 2
- Build precompiled ExDoc scripts on every release using GitHub Actions
- Introduce search across all of HexDocs HOT 29
- Admonition block content in cheat sheets has incorrect background colour HOT 4
- Refactor autolinking typespecs
- Add a redirect or non-indexed extras page HOT 4
- [PROPOSAL] generate docs for structs HOT 1
- Search for terms beginning with colon (e.g. ":if") HOT 5
- Support converting GitHub alerts to admonitions? HOT 1
- searching on `inner_content` doesn't give any useful results
- no results at all for `phx-update`
- Add "Edit Documentation" link HOT 3
- Adding formal support for filenames HOT 6
- Markdown not supported within <details> element. HOT 4
- Using keybind to focus search flickers the sidebar HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ex_doc.