christianalfoni / christianalfoni/markdown-to-react-components

Multiple line code transformations using MTRC

Open
#2 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
132
Forks
14
PR merge metrics
No merged PRs in 30d

Description

I am trying to put code such as

``` javascript
class MonadObject {
constructor(ob) {

this.x = mobservable.makeReactive(ob);

this.bnd = (func, ...args) => {
return func(this.x, ...args);
};

this.ret = w => {
Object.assign(this.x, w);
return this;
}
}
}
```

on a web page. I don't know how to put the whole snippet in quotes, other than concatenating line by line. Here is what I see in the Chrome browser console log after I insert the code in a running app:

code: "class Monad {↵ constructor(z) {↵↵ this.x = mobservable.makeReactive(z);↵↵ this.bnd = (func, ...args) => {↵ return func(this.x(), ...args);↵ };↵↵ this.ret = a => {↵ this.x(a);↵ return this;↵ };↵ }↵};"

Firefox shows the same thing I get when I put the Chrome text in markdown, namely:

``` javascript
class MonadObject { constructor(ob) { this.x = mobservable.makeReactive(ob); this.bnd = (func, ...args) => { return func(this.x, ...args); }; this.ret = w => { Object.assign(this.x, w); return this; } }}
```

I might soon have use for the full functionality of "markdown-to-react-components", but right now I don't need anything dynamic or interactive. I just want "this.state.content = ?" where ? never changes. I am trying "MTRC(x).tree, but I don't know how to substitute my "Monad" code for "x".

The examples show only single-line arguments for MTRC. If there is a way to use it with multiple lines of text, I think that would be of general interest. Or maybe I have a blind spot and everybody else already knows how to handle this.

Thanks to anybody who can point me in the right direction. This is great software and I feel confident that it is quite capable of handling my use case. But how?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.