BoostIO / BoostNote-Legacy

This repository is outdated and new Boost Note app is available! We've launched a new Boost Note app which supports real-time collaborative writing. https://github.com/BoostIO/BoostNote-App
Other
17.07k stars 1.47k forks source link

Allow importing of snippets as code blocks in markdown notes #597

Open depfryer opened 7 years ago

depfryer commented 7 years ago

why cannot combine a snippet code like a iframe for split the code and the explain of code

image the snippet

image the md

image the result

for detect the "route" use tag or folder + link

thanks for you answer 😄

Ha yes and a question a implementation of a slider ? 😲

kazup01 commented 7 years ago

Hi @depfryer san, wow it is sounds good to me! I want to get feedback from others.

asmsuechan commented 7 years ago

Hi, @depfryer. Chances are links between notes help to realize this feature request. I mean, the linked code snippet will be displayed as like an OGP in the preview mode.

refs: https://github.com/BoostIO/Boostnote/pull/336

depfryer commented 7 years ago

@asmsuechan it's for a link not a compiled view if you want to see the code you need to clic on or i don't uderstand ><

depfryer commented 7 years ago

ha yes I found a way for use it \o/ in browser/lib/markdown.js L23

 highlight: function (str, lang) {
    if (lang === 'flowchart') {
      return `<pre class="flowchart">${str}</pre>`
    }
    if (lang === 'sequence') {
      return `<pre class="sequence">${str}</pre>`
    }
    return '<pre class="code">' +
    createGutter(str) +
    '<code class="' + lang + '">' +
    str +
    '</code></pre>'
  }

just add a case lang == snippet (for exemple) who return

if(lang == 'snippets'){
     return '<pre class="code">' +
    createGutter(note.Getcontent()) +
    '<code class="' + note.getMode() + '">' +
    note.getContent() +
    '</code></pre>'
  }
}

but i don't know how to create the GetContent and getMode ><

depfryer commented 7 years ago

and for slide https://github.com/partageit/markdown-to-slides with a button convert

Flexo013 commented 5 years ago

This would be really nice for more modular notes and reusing certain snippets.

A potential addition would be to allow parameters for start and end line. Thus adding the ability to only show a section of code.