-
Notifications
You must be signed in to change notification settings - Fork 60
Add a common Markdown processor module #521
Comments
I'm not sure if common markdown cover this area, but for ceylondoc we need support for wiki links (so it should be extensible that way) |
I'd like to see a DOM-like API so it's possible to parse markdown into a tree, manipulate that tree programmatically and then render it. That's the fundamental reason why the dist has two markdown processors -- the one used by |
By default, this should be CommonMark compliant. However, we will need options to:
Also note that the Appendix describes a parsing strategy that we could use. (We might need a second, internal AST for Phase 1, which is then transformed into the shared AST for Phase 2.) |
This module can be used by:
|
I've been looking into this as a GSoC project and I would like to know where to begin. I was wondering if I have to write my own parser to build an AST? or is there any other way? |
I believe the commonmark spec outlines a parsing strategy, but you'd have
|
I have started working on a parser based on the parsing strategy outlined in the commonmark spec. I was wondering what @FroMage meant by frontend and backend in this case. Could anyone please elaborate? |
Frontend: Markdown to some form of AST. |
I have submitted a draft of my GSoC proposal that can be found here: https://gist.github.com/rohitmohan96/71451003ed758b791fc8 |
I have 4 days to submit my final proposal so I would like to hear your feedback asap. |
The proposal looks good to me. |
Thanks. If anyone else has any input you can comment on the gist itself. I have also started working on the parser which I'll push sometime this week. So I'll update the proposal then. |
So what's left to do? It would be nice to have this in the SDK and on herd. I'm currently bundling a custom build in the VSCode extension. |
Sublists (rohitmohan96/ceylon.markdown#1) don't work yet as intended and I still have to add all the tests from the CommonMark spec. I'll fix them as soon as I get time. |
Can this be released for |
I went back to the drawing board on this and did a direct port from I'm not sure if we can use this as a starting point for the module we need here, but it does pass all the CommonMark compliance tests! It'd need some extensions to its functionality, to support some of the use cases mentioned in this issue and to render ceylon-lang.org (which was why I started working on it in the first place). What do you all think? |
Why would it not be? |
It's a rhetorical device to soften the impact of my going back to the drawing board, instead of continuing Rohit's work (and borrowing the strategy of fetching the spec tests directly from the CommonMark repository). |
OK. |
I was able to extend the parser to parse wiki-style links and made a proof of concept for an AST transformation phase in the last comment on CPColin/ceylon.markdown#10, so we're getting close here! As far as I can tell, it shouldn't be too tough to do a similar transformation in the IDE plugins, based on what I saw in their code. |
In CPColin/ceylon.markdown#5 I have a checklist going for things I need to do in order to make the new module official. What else can I add to the list? Thanks! |
@CPColin how is this work going? |
The module should be functionally complete and ready to go, but I need a hand in the issue I linked in my last comment to figure out what changes I need to make to make it official and get it into the Herd. |
OK, thanks |
So what strategy should I take here? Should we try to get my code into the official Ceylon repo? Or should we get the module into the Herd and keep the code hosted in my personal repo? (I'm not sure how this sort of thing normally works, heh!) |
Well I guess I think it might be nice to publish a release to Herd so folks can try it out and give feedback first before merging it into the SDK... |
Okay, thanks. I'll get moving with claiming the module name in the Herd. Is there a particular license you'd prefer me to use? I don't have a preference, so whatever fits in with the rest of Ceylon is fine by me! Edit: Never mind. I see that the Apache license is preferred. I'll get that sorted out now. |
It's up! Thanks, everybody! |
I started looking at using this module in the I do think the new module can be used in the IDE plugins, though, since those are written in Ceylon. |
Hrm. OK, so maybe not such a great idea after all. |
Add a new
ceylon.markdown
module which processes Common Markdown (http://commonmark.org/) and renders Html, plain text, and possibly more outputs. The frontend and backend should be separate, with an SPI to allow other modules to provice custom backends (like man pages).The text was updated successfully, but these errors were encountered: