Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope stretching various Code-Blocks #74

Closed
joehannes-zz opened this issue Jun 27, 2017 · 4 comments
Closed

Scope stretching various Code-Blocks #74

joehannes-zz opened this issue Jun 27, 2017 · 4 comments

Comments

@joehannes-zz
Copy link

I am just finding my love for literate programming.
When coding and documenting heavily though, one thing doesn't work as desired ...

  • variable defined in one codeblock are not visible in other codeblocks

thus I can't use literate programming/markdown properly

  • Is it me, not knowing best practices of literate programming
  • Is there a workaround
  • Could this be a feature request

I understand this is almost impossible to implement, unless you

  • implement it for every literate programming lib out there, like write, literate-programming-lib, ...
  • invent your own convention like a sub-header-level 2 signifies it's own scope or something
  • simply think of one js file per md

However, I'm curious if you have thought about this and if there's a common best practice / workaround

@btmills
Copy link
Member

btmills commented Jul 2, 2017

Literate programming is definitely something I want to support with this plugin. It would most likely work by combining all JS code blocks into a single consecutive scope, basically just stripping out the Markdown to leave the JS. I haven't used that style myself, so can you point me to some other tools that already support it? I could add a setting in .eslintrc.js for just this plugin, but if there's a de facto standard for how to configure that, I'll use that instead.

@btmills btmills added enhancement and removed triage labels Jul 2, 2017
@joehannes-zz
Copy link
Author

hey, sounds awesome!!!
Basically I use joystylrs' lib.
There's command line tools as well, it's called litpro, it's on npm.

For my latest project where I've been using all of that ... you can have a look at it here
Just go to the literature folder and you'll find 4 markdown files which make up all of html, css, and js.

Litpro by joystylr is using conventions you could easily parse.
Basically he's using his compile directives like so [path/to/be/compiled/and/put/there.js](#Section-Heading "save:") ...

Now a ##Section Heading will be the starting point for this file ... until a new compile directive's heading begins.

I know there's other literate programming libs out there. I don't really know them, I just found this one to be pretty decent :) (eg: writ)

@jorgecasar
Copy link

"combining all JS code blocks into a single consecutive scope" it's a great feature to be able to validate markdown documentation using Markdown javascript

@btmills
Copy link
Member

btmills commented Feb 11, 2021

Based on what I've learned building this processor, it would be difficult to both extract code blocks individually and combine them as in literate programming. I'm closing this issue, but I'd welcome someone using this plugin as inspiration for building another plugin designed for combining code blocks. If you do build it, please share here!

@btmills btmills closed this as completed Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants