mmarkdown / mmark

Mmark: a powerful markdown processor in Go geared towards the IETF
https://mmark.miek.nl
Other
480 stars 45 forks source link

WIP: GopherJS integration #79

Closed bifurcation closed 5 years ago

bifurcation commented 5 years ago

My earlier work on draftr and draftr-js was pretty half-hearted, but the "no install" experience has been useful to a few people. It would be nice, though, if we could have a web-based Internet-draft authoring tool that kept pace with the more real tooling -- mmark.

This PR is a proof of concept for how this could be done fairly simply using GopherJS. To see how this works:

> go get -u github.com/gopherjs/gopherjs
> cd ${GOPATH}/src/github.com/mmarkdown/mmark/js
> gopherjs serve

# In browser opened to http://localhost:8080/github.com/mmarkdown/mmark/js
# Open browser console, and:
> doc = mmark.NewDocument(mmark.SampleData)
> html = doc.HTMLFragment()
miekg commented 5 years ago

That looks pretty cool. Multi file documents can work as well with this setup?

On Sun, 7 Jul 2019, 03:18 Richard Barnes, notifications@github.com wrote:

My earlier work on draftr https://ipv.sx/draftr and draftr-js https://draftr-js.github.io was pretty half-hearted, but the "no install" experience has been useful to a few people. It would be nice, though, if we could have a web-based Internet-draft authoring tool that kept pace with the more real tooling -- mmark.

This PR is a proof of concept for how this could be done fairly simply using GopherJS. To see how this works:

go get -u github.com/gopherjs/gopherjs cd ${GOPATH}/src/github.com/mmarkdown/mmark/js gopherjs serve

In browser opened to http://localhost:8080/github.com/mmarkdown/mmark/js

Open browser console, and:

doc = mmark.NewDocument(mmark.SampleData) html = doc.HTMLFragment()


You can view, comment on, or merge this pull request online at:

https://github.com/mmarkdown/mmark/pull/79 Commit Summary

  • First pass at GopherJS integration

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mmarkdown/mmark/pull/79?email_source=notifications&email_token=AACWIW734T7W3YLIHKB2Z5TP6E767A5CNFSM4H6USHD2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G5V4DEQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AACWIW3SJFCTMDWI6BIDK5TP6E767ANCNFSM4H6USHDQ .

bifurcation commented 5 years ago

@miekg My proposal is that we do not support multi-file documents in this interface. Seems simpler.

Latest commit adds a simple web interface adapted from draftr-js. Once you have gopherjs serve running, you should be able to go to http://localhost:8080/github.com/mmarkdown/mmark/js and get a two-panel view that auto-updates the HTML as you edit the MD.

It seems like the TODO to get this to a usable state would be something like:

miekg commented 5 years ago

There is no reason why this code should live in this repository, happy to make a mmarkdown/js repo so we can put it there?

bifurcation commented 5 years ago

The main reason I started here was ease of keeping it up to date. If the web code is in this repo (say in the gh-pages branch), then it's easy to set CI triggers that update the JS to match the current Go code. (cf. the work Martin has done with Internet-drafts) It's probably possible to set something up across repos, just a bit more complicated.

miekg commented 5 years ago

[ Quoting notifications@github.com in "Re: [mmarkdown/mmark] WIP: GopherJS..." ]

It's probably possible to set something up across repos, just a bit more complicated.

good :-) Because there is no real reason to have it live here.

miekg commented 5 years ago

Closing as this does not need to live in the main repo.