Comments (4)
Ahh you still have to write the link as module.md#class:ClassName
, instead of module::ClassName
. Getting there requires a little bit of parsing of the Markdown content itself, which right now we just output verbatim. It is on the roadmap, though.
from illiterate.
I think is ready now. You can reference any top-level type or method with ref:module.name
and it will be automatically converted to the right path.
from illiterate.
Yeah, I love that! It is definitely something I want to have. I think this would require automatically inserting some <a/>
tags for every class (and method?) in the markdown. In any case, this will require a little bit more "parsing" of the Python source, maybe it's OK for an MVP to just check for a r"class (.+):\n"
line instead of actually lifting the AST, but in the long run probably a full parsing of the code will be useful for a lot of these kind of tweaks.
from illiterate.
So, I tried parsing the code with Python ast
module. That's a definite no-no because first, it will drop comments (obviously 🤦 ) and second we have no way to ensure we can dump the exact same code layout. So I kind of solved this with regexes by looking for class
and def
top-level definitions.
Now we output anchors for each of these, right before the Python block where they are defined. The bad news is that if you have more than one in the same Python block, all their anchors will point to the same block, not to individual lines inside the block because there is no easy way to inject HTML inside Markdown code blocks. But at least is something.
from illiterate.
Related Issues (5)
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 illiterate.