Code Scrawl
A documentation generation framework with some built-in extensions for exporting comments and code, and importing into markdown.
Status
Library works pretty well, but isn't stable yet (some internals may change soon), and its poorly documented right now. I hope this will be fixed by the end of April 2021. Today is April 1, 2021.
Getting Started
1. Install
- Download:
git clone https://gitlab.com/taeluf/php/CodeScrawl.git CodeScrawl
(put this anywhere you like) - Modify bashrc:
echo "export PATH=\""$(pwd)/CodeScrawl/cli:\$PATH"\"" >> ~/.bashrc;
- To manually edit:
gedit ~/.bashrc
, orxed ~/.bashrc
,vim ~/.bashrc
,nano ~/.bashrc
- To manually edit:
- Reload terminal:
source ~/.bashrc
2. Simple Example
- Create some folders & files:
-
docs/
<- Output directory -
docs-src/
<- Documenation template files -
docs-src/Test.src.md
<- A template file -
src/SomeFile.php
<- It doesn't have to be PHP.
-
- Add a docblock export to your code:
-
@TODO support alternative docblock syntax, such as/** * I am a docblock * @export(Docblock.Test) */
##\n#\n#
-
- Add a wrapped export to your code:
-
Also supports// @export_start(WrappedCode.Test) echo "I am an echo"; // @export_end(WrappedCode.Test)
# @export_...
-
- Import into your docs. In
docs-src/Test.src.md
, write:-
# Example of Docblock Import: @import(Docblock.Test) # Example of Wrapped Import: This is a nice way to auto copy+paste production or test code into your markdown file. ```php @import(WrappedCode.Test) ```
-
- Run Code Scrawl.
cd
into your project directory, then executescrawl
. - Review
docs/Test.md
. The@import(KEY)
calls will be replaced
3. Doing More
Now you have the basics. Please submit an issue to improve our docs if this intro has been insufficient.
- Configuration: Stored in
YOUR_PROJECT/.config/scrawl.json
orYOUR_PROJECT/.scrawl.json
. See docs/Config.md - Regex Matching: See docs/RegexMatching.md
- Extensions: See docs/Extensions.md. You can make shared extensions for others to use or personal extensions that do something very specific for your project.
- Cli Options & Direct PHP execution: See docs/CliAndPhp.md
- Additional technical Stuff: See docs/TechnicalStuff.md
- TODOs: See docs/Todo.md