Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Deep parsing for instructions #1

Open
Marsup opened this issue Apr 25, 2017 · 3 comments
Open

Deep parsing for instructions #1

Marsup opened this issue Apr 25, 2017 · 3 comments

Comments

@Marsup
Copy link

Marsup commented Apr 25, 2017

Hi !

Do you think you would be open to a change to this library to allow for deep syntax substitution ?

What I mean by that is something like # Title <? @macro return 'something' ?> is not supported because it's not its own instruction.

I would find mkdoc even more useful if it were, I'm just wondering if it would not complicate it too much since it would then need escaping to not interpret your own documentation.

Curious what you think is best to support this (if at all).

@tmpfs
Copy link
Contributor

tmpfs commented Apr 26, 2017

Thanks for the input :)

I have no problem with inline processing instructions. You can see the difference in the AST with these commands:

echo '# title <? @macro return "foo" ?>' | mkcat | mkout -y

Which yields:

---
- document:
  - heading:
    - text: 'title '
    - html_inline: '<? @macro return "foo" ?>'
---

And for blocks:

echo '# title\n\n<? @macro return "foo" ?>' | mkcat | mkout -y

Which gives a html block node:

---
- document:
  - heading:
    - text: 'title'
  - html_block: '<? @macro return "foo" ?>'
---

I have submitted a PR to commonmark.js which would allow this, see:

commonmark/commonmark.js#97

My fork has this code already IIRC but I was hoping to get it into the upstream code before implementing, maybe you want to chime in on the PR so we might get it merged?

@Marsup
Copy link
Author

Marsup commented Apr 26, 2017

Maybe he's waiting for you to resolve conflicts on this PR ?

@tmpfs
Copy link
Contributor

tmpfs commented Apr 26, 2017

There were no conflicts when I submitted the PR ;) It's been sitting there for some time, I can fix the conflicts but I can't be sure the PR will be merged :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants