Couscous is good.

Overview
layout
home

Couscous generates a GitHub pages website from your markdown documentation.

Build Status Average time to resolve an issue Percentage of issues still open

Everything is documented on couscous.io.

What follows is the documentation for contributors.

How Couscous works?

Couscous was designed to be as simple as possible. By embracing simplicity, it becomes extremely simple to extend.

Website generation

The website generation is composed of a list of steps to process the Project model object:

interface Step
{
    /**
     * Process the given project.
     *
     * @param Project $project
     */
    public function __invoke(Project $project);
}

Steps are very granular, thus extremely easy to write and test. For example:

  • LoadConfig: load the couscous.yml config file
  • InstallDependencies: install the dependencies (using yarn, npm or bower)
  • LoadMarkdownFiles: load the content of all the *.md files in memory
  • RenderMarkdown: render the markdown content
  • WriteFiles: write the in-memory processed files to the target directory

For example, here is a step that would preprocess Markdown files to put the word "Couscous" in bold:

class PutCouscousInBold implements \Couscous\Step
{
    public function __invoke(Project $project)
    {
        /** @var MarkdownFile[] $markdownFiles */
        $markdownFiles = $project->findFilesByType('Couscous\Model\MarkdownFile');

        foreach ($markdownFiles as $file) {
            $file->content = str_replace('Couscous', '**Couscous**', $file->content);
        }
    }
}

Couscous uses PHP-DI for wiring everything together with dependency injection.

The full list of steps is configured in src/Application/config.php.

Website deployment

Couscous deploys by cloning (in a temp directory) the current repository, checking out the gh-pages branch, generating the website inside it, committing and pushing.

In the future, Couscous will support several deployment strategies.

Contributing

See the CONTRIBUTING file.

License

Couscous is released under the MIT License.

Comments
  • Deploy gh-pages branch from travis

    Deploy gh-pages branch from travis

    WIP for #34

    (this is #44 but merged into a local branch so that we can all push commits to it and we can test the results in this repository)

    To safely deploy with Couscous from a Travis build we need to take this things into consideration:

    • [x] Make sure the deployment is running only for master.
    • [x] Make sure it is not a pull request.
    • [x] Make sure we deploy once per build. E.G. don't deploy for every PHP version tested :smile:
    • [x] Decide what to use to deploy: Private Key or Personal Access Token
    • [x] Write documentation in docs/travis.md
    • [ ] ~~Couscous specific problem: don't generate & upload couscous.phar for pushes to master (else we might push an unstable phar)~~ (will be done in a new PR)

    The process is detailed in docs/travis.md

    Feel free to add commits and keep working on this together.

    enhancement 
    opened by mnapoli 18
  • Adding livereload python dependency to allow to automatically refresh web pages when content or assets are changed.

    Adding livereload python dependency to allow to automatically refresh web pages when content or assets are changed.

    What do you think about this @mnapoli?

    As you can see in the TODO, sometimes livereload is too fast when reloading page and content is not found... I tried different values for polling but seems to behave always the same...

    Feel free to try anything else to optimize this ;).

    Resolves #91.

    enhancement 
    opened by wysow 13
  • Github Action

    Github Action

    Hi, I just made an action for Github : https://github.com/BilelJegham/action-couscous I add to the doc the github workflow.

    Do you want to owe the repo on Couscous org ?

    enhancement 
    opened by BilelJegham 12
  • Add a metadata to generate a CNAME file

    Add a metadata to generate a CNAME file

    This fixes the problem with CNAME and remote templates which is mentioned in the docs/configuration. Setting a cname metadata in couscous.yml generates a CNAME file.

    If you find a good idea, I can add some documentation and provide some tests too.

    enhancement 
    opened by leoruhland 12
  • [Windows] bash: /dev/tty: No such device or address

    [Windows] bash: /dev/tty: No such device or address

    More Windows problems, I'm afraid.

    I recently did a clean install of Windows 10 to solve some ongoing problems with my laptop. I restored most of the original apps and data to their original locations, but some are still not installed as I haven't needed them yet.

    In any case, running php "C:\Users\djmar\OneDrive\Development\Web\Couscous\couscous.phar" deploy -v fails at GitHub login:

    Deploying the website
    Cloning https://github.com/cyberbit/modation.git in C:\Users\djmar\AppData\Local\Temp\couAAEE.tmp
    Checking out branch gh-pages
    Copying generated website
    Committing changes
    warning: LF will be replaced by CRLF in docs/index.html.
    The file will have its original line endings in your working directory.
    warning: LF will be replaced by CRLF in index.html.
    The file will have its original line endings in your working directory.
    Pushing gh-pages (GitHub may ask you to login)
    
    
    
      [Couscous\CommandRunner\CommandException]
      bash: /dev/tty: No such device or address
      error: failed to execute prompt script (exit code 1)
      fatal: could not read Username for 'https://github.com': Invalid argument
    
    
    
    Exception trace:
     () at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/src/CommandRunner/CommandRunner.php:29
     Couscous\CommandRunner\CommandRunner->run() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/src/CommandRunner/Git.php:61
     Couscous\CommandRunner\Git->run() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/src/CommandRunner/Git.php:44
     Couscous\CommandRunner\Git->push() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/src/Deployer.php:118
     Couscous\Deployer->pushBranch() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/src/Deployer.php:56
     Couscous\Deployer->deploy() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/src/Application/Cli/DeployCommand.php:106
     Couscous\Application\Cli\DeployCommand->execute() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/vendor/symfony/console/Command/Command.php:259
     Symfony\Component\Console\Command\Command->run() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/vendor/symfony/console/Application.php:878
     Symfony\Component\Console\Application->doRunCommand() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/vendor/symfony/console/Application.php:195
     Symfony\Component\Console\Application->doRun() at phar://C:/Users/djmar/OneDrive/Development/Web/Couscous/couscous.phar/vendor/symfony/console/Application.php:126
     Symfony\Component\Console\Application->run() at C:\Users\djmar\OneDrive\Development\Web\Couscous\couscous.phar:52
    

    I had previously installed MinGW and Cygwin (which aren't installed at the moment), which could be the problem. I'll update here as I learn more.

    opened by cyberbit 12
  • Install issues.

    Install issues.

    Running: curl -OS http://couscous.couscous.phar Results in: curl: Remote file name has no length!

    Installing via the global installation of Composer works. But running

    couscous preview

    results in:

    -bash: couscous: command not found

    What am I missing here?

    question 
    opened by JayHoltslander 12
  • Table of contents extracted from Markdown documents

    Table of contents extracted from Markdown documents

    A new step extracts a table of contents from Markdown documents (list of headers) and makes it available as metadata. Uses the latest commonmark (we end up with 2 Markdown parser because this one doesn't support Markdown Extra).

    With this new step, we now have this metadata available in Twig layouts:

    <h1>{{ tableOfContents.title }}</h1>
    <p>
        Table of contents:
    </p>
    {{ tableOfContents.toHtmlList() }}
    

    API of tableOfContents:

    • title: the title of the current document (i.e. first header of level 1)
    • toHtmlList(): generates the summary as a HTML list (<ul>)

    TODO:

    • [x] Require a stable dependency in composer.json (i.e. wait for a new release of commonmark)
    • [x] ~~Should the metadata key be document instead of tableOfContents?~~ (no)
    • [x] Update to the latest CommonMark version
    • [x] Merge master
    • [ ] The list should contain links to headers. Related to #39
    • [ ] Documentation
    enhancement 
    opened by mnapoli 11
  • Render Markdown files in unique directories.

    Render Markdown files in unique directories.

    I'm sure this is an easy PEBKAC error but I'm not finding the solution...

    in my project directory I have /docs/git-faq.md. When I write to the file Couscous notices:

    1 file(s) changed: regenerating (docs/git-faq.md)
    Generating /home/alex/repos/tir to /home/alex/repos/tir/.couscous/generated
    

    But when I go to http://127.0.0.1:8000/docs/git-faq I get:

    The requested resource /docs/git-faq was not found on this server.

    question 
    opened by alexfornuto 9
  • Read excluded directories from the `.gitignore` file of the repository

    Read excluded directories from the `.gitignore` file of the repository

    This allows users to have their git ignored files and directories automatically ignored by Couscous. To enable this feature, they will have to add the special %gitignore% entry to their exclude list.

    Why do we use a special entry? To keep the actual behavior unchanged and avoid unexpected generation errors.

    The actual implementation is a bit naïve: it will take each entry line from the .gitignore and add them to the exclude list of Couscous. So we might end up adding files and directories. It's hard to test every .gitignore entry to see if the are actual directories: paths might be relative or patterns, starting from the repository's root directory or not.

    Moreover, the implementation does not support complex pattern as git would.

    enhancement 
    opened by jubianchi 9
  • Using variables in content files

    Using variables in content files

    Is it possible to define variables either globally in couscous.yml or at least at the page-level using YAML front-matter and use them from within the MD files? E.g.:

    couscous.yml

     foo: bar
    

    page.md

    <h1> {{ foo }} </h1>
    

    or

    page.md

    
    ---
    foo: bar
    
    ---
    
    <h1> {{ foo }} </h1>
    

    This might be a nice feature to have, especially for frequently updated strings which need to be reused on multiple pages.

    question 
    opened by romovs 9
  • Link to current file in GitHub

    Link to current file in GitHub

    For wallabag's documentation or PHP-DI too (https://github.com/mnapoli/PHP-DI/issues/132), it would be useful to show "Edit this documentation article" buttons.

    To do this, we need to be able to know the name of the current file.

    I'm thinking it wouldn't be hard to create a new Markdown step that just sets a metadata variable currentFile with the relative filename.

    enhancement easy-pick 
    opened by mnapoli 9
  • Fatal with GitHubAction

    Fatal with GitHubAction

    Hi,

    On my GitHubAction: https://github.com/llaumgui/JunitXml/runs/2712050364?check_suite_focus=true

    Deprecated: Method ReflectionParameter::getClass() is deprecated in /tmp/vendor/php-di/php-di/src/DI/Definition/Source/Autowiring.php on line 52
    Generating /github/workspace to /github/workspace/.couscous/generated
    [notice] Fetching template from https://github.com/CouscousPHP/Template-Dark
    
    Fatal error: Uncaught TypeError: Return value of "Couscous\Application\Cli\GenerateCommand::execute()" must be of the type int, "null" returned. in /tmp/vendor/symfony/console/Command/Command.php:291
    Stack trace:
    #0 /tmp/vendor/symfony/console/Application.php(974): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #1 /tmp/vendor/symfony/console/Application.php(291): Symfony\Component\Console\Application->doRunCommand(Object(Couscous\Application\Cli\GenerateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #2 /tmp/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #3 /tmp/vendor/couscous/couscous/bin/couscous(43): Symfony\Component\Console\Application->run()
    #4 {main}
      thrown in /tmp/vendor/symfony/console/Command/Command.php on line 291
    
    opened by llaumgui 0
  • Incompatibility in the last release

    Incompatibility in the last release

    Hi,

    A few months back I made a few PRs to upgrade the code and allow to use symfony 5.

    The problem is that only one of them is available in 1.8.0 so if anybody use the couscous github action or do a composer update they will use the symfony 5 packages but it will crash because the commands do not return an exit code (required since symfony 5).

    Such a crash can be viewed here

    opened by Baptouuuu 0
  • improvement : Highlight.php ?

    improvement : Highlight.php ?

    Hi,

    Nice piece of code. I have just tested this tool but it seems to do the work. Simple and powerfull.

    Just my 2 cents opinion, I think using the highlighter "https://github.com/scrivo/highlight.php" could be a fine plugin to Couscous, the idea is that most of the site using coucous should also use an highlighter (mostly in javascript to apply the highlight on the fly) so a plugin to enable the highlight during the conversion of markdow to html file could be a plus. And the user could simply add the highlight.js CSS file.

    What do you think ?

    opened by ncou 2
  • Couscous preview throws Fatal Error

    Couscous preview throws Fatal Error

    System: Windows 10 Pro Couscous 1.7.3

    Issue: When running the couscous preview command, the console returns:

    Fatal error: Uncaught TypeError: Argument 1 passed to DOMNode::replaceChild() must be an instance of DOMNode, null given in erusev\parsedown-extra\ParsedownExtra.php:473

    Edit: The error disappears when removing a file with the name 6.0 Full-stack PHP, PDO, OOP, MySQl.md

    opened by advename 0
  • Support for filenames with special characters

    Support for filenames with special characters

    Couscous doesn't support files with special characters in them. In fact these files are ignored when generating the output and this very ambiguous error is shown.

    In Filesystem.php line 638:

    A temporary file could not be created.

    opened by alexanderwink 0
Releases(1.9.5)
Pretty Good Privacy (PGP) is an encryption program that provides cryptographic privacy and authentication for data communication.

Pretty Good Privacy (PGP) is an encryption program that provides cryptographic privacy and authentication for data communication. PGP is used for signing, encrypting, and decrypting texts, e-mails, files, directories, and whole disk partitions and to increase the security of e-mail communications. Phil Zimmermann developed PGP in 1991.

[sCRiPTz-TEAM] 3 Dec 31, 2021
A Laravel 4 CMS – WARNING: This project is no longer being developed because there are many good alternatives now.

This is the main larapress repository. Warning: This Application is under development and not yet production ready! Important Links Installation Contr

Martin Hettiger 155 Sep 27, 2022
A good, non-specialized Laravel base site for faster app development

Larastrap This is a non-specialized Laravel base site containing generalized components for faster development of nearly any type of site. It includes

Memphis PHP 2 Jul 31, 2022
churn-php is a package that helps you identify php files in your project that could be good candidates for refactoring

churn-php Helps discover good candidates for refactoring. Table of Contents What Is it? Compatibility How to Install? How to Use? How to Configure? Si

Bill Mitchell 1.3k Dec 22, 2022
Laravel Livewire component to show Events in a good looking monthly calendar

Livewire Calendar This package allows you to build a Livewire monthly calendar grid to show events for each day. Events can be loaded from within the

Andrés Santibáñez 680 Jan 4, 2023
A good plugin to play a sound when the player hits the enemy's head

HeadshotSound A good plugin to play a sound when the player hits the enemy's head. How to use Hit the player with a snowball, egg and bow in the head

Laith Youtuber 6 Nov 3, 2022