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

Inline JavaScript to generate content #73

Open
hagenburger opened this issue Sep 29, 2018 · 0 comments
Open

Inline JavaScript to generate content #73

hagenburger opened this issue Sep 29, 2018 · 0 comments
Labels
enhancement New feature or request plugin specification-needed Help finishing the specification before working on this

Comments

@hagenburger
Copy link
Owner

New feature

Allow inline JavaScript to create or manipulate content.

Specifications

Tbd.

Example use cases

Create a list out of files

The following Markdown:

# Overview of plugins

<?js
  const fs = require("fs")
  const dir = "./plugins"
  const links = []
  fs.readdirSync(dir).forEach(file => {
    const path = dir + "/" + file
    if (fs.statSync(path).isDirectory()) {
      links.push(`<li><a href="${path}/README.md">${file}</a></li>`)
    }
  })
  const html = `<ul>\n  ${links.join("\n  ")}\n</ul>`
  return html
?>

Should generate (assuming it was called from this repository):

<h1>Overview of plugins</h1>
<ul>
  <li><a href="./plugins/classes/README.md">classes</a></li>
  <li><a href="./plugins/gulp-pimd/README.md">gulp-pimd</a></li>
  <li><a href="./plugins/highlight/README.md">highlight</a></li>
  <li><a href="./plugins/html-injector/README.md">html-injector</a></li>
  <li><a href="./plugins/id/README.md">id</a></li>
  <li><a href="./plugins/preview/README.md">preview</a></li>
  <li><a href="./plugins/prism/README.md">prism</a></li>
  <li><a href="./plugins/showmore/README.md">showmore</a></li>
</ul>
@hagenburger hagenburger added enhancement New feature or request plugin specification-needed Help finishing the specification before working on this labels Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin specification-needed Help finishing the specification before working on this
Projects
None yet
Development

No branches or pull requests

1 participant