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

Ability to have separate blocks of code in a snippet #34

Open
davidnknight opened this issue Dec 30, 2013 · 4 comments
Open

Ability to have separate blocks of code in a snippet #34

davidnknight opened this issue Dec 30, 2013 · 4 comments

Comments

@davidnknight
Copy link
Collaborator

Many snippets are including code that is intended to be used in different files, including some of my own, it would be better if we were able to have different blocks of code per file which would provide a clearer visual separation rather than having to add multiple empty lines and comment blocks. Would also be nice to optionally add path/filename along with each block of code.

@johnnncodes
Copy link
Owner

Yeah, this feature would be nice.

@jpalala
Copy link

jpalala commented Dec 31, 2013

You could differentiate a plain snippet from a post/article. this could have basically a +- snippet via javascript, which adds more input title+textareas into the form using php's to put code into. upon post, it submits a snippet as a bundle of snippets. you just would need a flag in a database which identifies the parent snippet of the subsnippets, with the parent snippet only describing each of the associated snippets.

@jpalala
Copy link

jpalala commented Dec 31, 2013

the other option is, create an interface which automatically does the above and publishes it into the simple markdown needed for presentation of the "snippet". Hmm hows the best way to implement this? :)

@johnnncodes
Copy link
Owner

I think we could use Github flavoured markdown.

So snippets will have code blocks like:

This is a normal text.

public function codeBlock() {
    echo 'Hello World';
}

Another normal text, blah, blah, blah...

public function justAnotherCodeBlock() {
    echo 'Hello World';
}

erusev/parsedown package is already used by the site to support Github markdown in description area (credits to: @chrispitt ).

Thoughts? Or any other suggestions?

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

3 participants