yiisoft / yii2-apidoc Goto Github PK
View Code? Open in Web Editor NEWYii 2 apidoc extension.
Home Page: https://www.yiiframework.com
License: BSD 3-Clause "New" or "Revised" License
Yii 2 apidoc extension.
Home Page: https://www.yiiframework.com
License: BSD 3-Clause "New" or "Revised" License
This issue has originally been reported by @cebe at yiisoft/yii2#4279.
Moved here by @cebe.
No priority for now but here are some references:
This issue has originally been reported by @nkovacs at yiisoft/yii2#9541.
Moved here by @cebe.
Go to http://www.yiiframework.com/doc-2.0/index.html and search for "sort" or "Sort". There will be no results.
"sor" and "sorti" works.
This issue has originally been reported by @slinstj at yiisoft/yii2#8773.
Moved here by @cebe.
Principle: the guide's text should be the king:
Should have more space for the text;
Menu icon on the right up corner takes the entire line space, pushing the title down;
Should have a floating menu icon having the topics;
"Go to top" icon could be smaller and should not stand so over the text;
I don't think the "pencil" edit icon is useful since editions use to be made via PR. It's only one more thing to stands over the text;
At the end of the each topic it should be a next/before topic links;
This issue has originally been reported by @mdmunir at yiisoft/yii2#5614.
Moved here by @cebe.
During use apidoc, i found several bug/unexpected result.
I have README.md
with line
- [Change Log](CHANGELOG.md).
- [Basic Usage](docs/guide/basic-usage.md).
- [Using Menu](docs/guide/using-menu.md).
in generated doc (guide-README.html) a good link only for Change Log
(guide-CHANGELOG.html) but for Basic Usage
and Using Menu
dont. Generated link.
<li><a href="guide-CHANGELOG.html">Change Log</a>.</li>
<li><a href="docs/guide/basic-usage.md">Basic Usage</a>.</li>
<li><a href="docs/guide/using-menu.md">Using Menu</a>.</li>
@property
clause.Apidoc only read setter and getter methode but no read from @propety
.
I have line
* @property Menu[] $menus
*/
...
/**
* @return ActiveQuery
*/
public function getMenus()
{
return $this->hasMany(...
}
generated doc is [$menus
type ActiveQuery
] instead of [$menus
type Menu[]
]
I got throw exeption try to get property of non object
. No other message, no error line, just apllication exit. I need a full day to investigate this trouble. I found that is caused when we have public methode setXyz()
with no parameter. can you add another good error message or error line 😀 ?
Let's take the example of the page http://www.yiiframework.com/doc-2.0/yii-bootstrap-html.html, I would like to suggest small improvements in the guide for all extensions:
Searching files to process... Exception 'yii\base\InvalidParamException' with message 'The dir argument must be a directory: /Users/samdark/src/yiiframework.com/data/yii-2.0/docs/guide'
Instead of throwing an exception it can create a directory.
At the moment only the php code highlighter is working.
When i want to use the js code highlighter i use this ```js
but the code is not highlightet.
This issue has originally been reported by @schmunk42 at yiisoft/yii2#3547.
Moved here by @cebe.
As you can specify different sourceDirs
when rendering a guide, apidoc should also be able to correctly link to different files, even if they have the same source name.
Eg, if you specify two directories and both contain a README.md
file you'll see both files in the index in the left sidebar, but you can access only one of them, since they have the same filename when rendered.
I played around with something like this:
protected function generateGuideFileName($file)
{
$uniqueFileName = static::GUIDE_PREFIX . substr(sha1($file),0,6) . '-' . basename($file, '.md');
return $uniqueFileName . '.html';
}
But it needs to be handled in more places, like generateGuideUrl
.
What do you think about the approach adding a hash to the filename, any other ideas?
Hi, I trying to create some tables, but there's no border and no spacing on the cells. Am I missing something? Thanks.
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
This issue has originally been reported by @mithun12000 at yiisoft/yii2#6104.
Moved here by @cebe.
Hi all,
Can i see that you have hard coded extension list in apidoc
how can i add custom extension in that list so it will create extension doc in similar fashion.
Also I am interested to know that is there any way to generate Module API doc in similar fashion of extension doc?
regards
Mithun Mandal
This issue has originally been reported by @schmunk42 at yiisoft/yii2#5607.
Moved here by @cebe.
I tried to create a custom apidoc and guide renderer by extending the one from the bootstrap template.
But it looks to me like I can not get past these two lines, with a custom generator location:
https://github.com/yiisoft/yii2/blob/master/extensions/apidoc/commands/ApiController.php#L145
https://github.com/yiisoft/yii2/blob/master/extensions/apidoc/commands/GuideController.php#L96
Should be i.e. changed to params with absolute paths/NS, what do you think?
hi it's so long time you dose not work on this repo.
and this part of yii is very important to have api document, setting template get pdf and ...
this repo is the difference by other framework.
This issue has originally been reported by @FabrizioCaldarelli at yiisoft/yii2#8560.
Moved here by @cebe.
When use apidoc to generate documentation, @property
items in comment immediately before class statement are not published in html.
This example will return in html documentation only "This is the model class for table "tbl_auth_item"",
without all properties declared.
/**
* This is the model class for table "tbl_auth_item".
*
* @property string $name
* @property integer $type
* @property string $description
* @property string $ruleName
* @property string $data
*
*/
class PrenotazioniController extends \api\components\BaseController
{
.....
}
Hi!
I just noticed a @Property which described before a class declarations do not rendered to result apidoc htmls :(
For example, even AR-model classes genereated by gii have such @Property comments for each db field, but they do not appers in the docs.
Other case is for AR-relations. If a model have a relation to (for ex) User model, there is a method like:
/**
* @return \yii\db\ActiveQuery
*/
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id']);
}
While the method $model->getUser()
returns ActiveQuery, the magic property $model->user
will return User class instance (see why). I think, it is enough reason to describe the method and property separately.
It is possible to put magic @Property comments/descriptions to the result docs indepenently from the getter/setter method?
Thank you!
https://github.com/yiisoft/yii2/blob/master/docs/guide/db-query-builder.md#yiidbqueryorderbyorderby-
http://www.yiiframework.com/doc-2.0/guide-db-query-builder.html#order-by
In our rendered version code block is broken.
$ composer require --prefer-dist yiisoft/yii2-apidoc
Using version ^2.0 for yiisoft/yii2-apidoc
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for cebe/markdown == 1.1.0.0 -> satisfiable by cebe/markdown[1.1.0].
- yiisoft/yii2-apidoc 2.0.0 requires cebe/markdown-latex * -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.1 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.2 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.3 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.4 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- Conclusion: don't install cebe/markdown-latex 1.0.0
- Installation request for yiisoft/yii2-apidoc ^2.0 -> satisfiable by yiisoft/yii2-apidoc[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].
Installation failed, reverting ./composer.json to its original content.
This issue has originally been reported by @cebe at yiisoft/yii2#3570.
Moved here by @cebe.
see #3539
Latest yii2-app-basic (2.0.6, 2015-09-30) has dependency on cebe/markdown 1.1.0 in composer.lock.
This conflicts with yii2-apidoc (cebe/markdown-latex), unable to install through composer.
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
cd basic
composer require --prefer-dist yiisoft/yii2-apidoc
Result:
Problem 1
- Installation request for cebe/markdown == 1.1.0.0 -> satisfiable by cebe/markdown[1.1.0].
- yiisoft/yii2-apidoc 2.0.0 requires cebe/markdown-latex * -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.1 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.2 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.3 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.4 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- Conclusion: don't install cebe/markdown-latex 1.0.0
- Installation request for yiisoft/yii2-apidoc ^2.0 -> satisfiable by yiisoft/yii2-apidoc[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].
i installed manually composer create-project --prefer-dist yiisoft/yii2-apidoc yii2 2.0.0
, it downloads all pretty well.
but then when i generate the api with this command
yii2/apidoc api yii2 ./output
it throws this message
Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
39 files to update.
Processing files... done.(39/39) ETA: 0 sec.
Updating cross references and backlinks... done.
Rendering files: done.(40/40) ETA: 0 sec.
generating extension index files...done.
generating search index...done.
202 errors have been logged to ./output/errors.txt
you can check the file in here
this command is ran under windows 10 cmd
When add a description to a function or a class the apidoc show this error:
Searching files to process... done.
Loading apidoc data from cache... done.
Checking for updated files... done.
1 file to update.
Processing files... done.
Updating cross references and backlinks... done.
Rendering files: 0% (0/2) ETA: n/a Error: array_unshift() expects parameter 1 to be array, object given
This: https://github.com/yiisoft/yii2/blob/master/framework/rbac/Item.php#L22
should be inherited by these:
https://github.com/yiisoft/yii2/blob/master/framework/rbac/Role.php#L17
https://github.com/yiisoft/yii2/blob/master/framework/rbac/Permission.php#L17
But the documentation ends up being empty: http://www.yiiframework.com/doc-2.0/yii-rbac-role.html#properties
This issue has originally been reported by @speicus at yiisoft/yii2#9548.
Moved here by @cebe.
http://www.yiiframework.com/doc-2.0/guide-README.html
Check the "Advanced Project Template" in the "Special Topics" section — it leads to guide-README.html.
This issue has originally been reported by @qiansen1386 at yiisoft/yii2#5764.
Moved here by @cebe.
@cebe I tried the APIdoc extension these days, it is awesome! However, i found some bugs.
I installed make and pdflatex, and write a Batch file to automatically publish doc into my friend's GitHub page.
Here is the snippet of PDF generation portion:
@echo off
cd "D:\GitHub\yii2-src\extensions\apidoc"
echo yes|apidoc guide D:\GitHub\yii2-doc-temp D:\GitHub\ab**.github.io\download --template=pdf
cd D:\GitHub\ab**.github.io\download
make pdf
echo "Done! "
pause
exit
Btw, the encoding issue which you already know.....It is quiet important for us, since we rely on the site to publish new Chinese translations.
http://www.yiiframework.com/doc-2.0/yii-helpers-basearrayhelper.html#multisort()-detail
public static void multisort ( <b>&</b>$array, $key, $direction = SORT_ASC, $sortFlag = SORT_REGULAR )
Note <b>
tags.
Deprecated methods are displayed like others, without any indication that it has been deprecated. It does not even include that in the description of the method, and the @deprecated
annotation is just removed.
If I want to change the doc style, and I don't want change the code in vendor folder. How could I do?
To experience the problem
https://github.com/Chofoteddy/yii2-bootstrap-wizard/blob/master/WizardAsset.php this class with the command
./vendor/bin/apidoc api . docs/json --exclude="docs,vendor"
return this https://github.com/Chofoteddy/yii2-bootstrap-wizard/blob/master/docs/classes/chofoteddy-wizard-wizardasset.html html which doesn't contain any information about the properties documented with @inheritdoc tag.
Relates to #37
The problem is i have an interface that extends from 'yii\base\ViewContextInterface'. If it doesn't the error doesn't occur.
Stack trace:
Searching files to process... done.
Loading apidoc data from cache... done.
Checking for updated files... done.
1 file to update.
Processing files... done.(1/1) ETA: n/a
Updating cross references and backlinks... PHP Notice 'yii\base\ErrorException'
with message 'Undefined property: stdClass::$methods'
in C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\models\Context.php:187
Stack trace:
#0 C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\components\BaseController.php(
148): yii\apidoc\models\Context->updateReferences()
#1 C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\commands\ApiController.php(108
): yii\apidoc\components\BaseController->updateContext()
#2 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\InlineAction.php(55): yii\apidoc
\commands\ApiController->actionIndex()
#3 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\InlineAction.php(55): ::call_use
r_func_array:{C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\InlineAction.php:55}(
)
#4 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\Controller.php(154): yii\base\In
lineAction->runWithParams()
#5 C:\wamp\www\big-cms\vendor\yiisoft\yii2\console\Controller.php(108): yii\base
\Controller->runAction()
#6 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\Module.php(454): yii\console\Con
troller->runAction()
#7 C:\wamp\www\big-cms\vendor\yiisoft\yii2\console\Application.php(167): yii\bas
e\Module->runAction()
#8 C:\wamp\www\big-cms\vendor\yiisoft\yii2\console\Application.php(143): yii\con
sole\Application->runAction()
#9 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\Application.php(375): yii\consol
e\Application->handleRequest()
#10 C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\apidoc(53): yii\base\Applicat
ion->run()
#11 {main}
vendor/bin/apidoc api /path..../models ./output
Searching files to process... done.
Loading apidoc data from cache... done.
Checking for updated files... done.
0 files to update.
Processing files... done.
Updating cross references and backlinks... done.
Rendering files: 0% (0/36) ETA: n/a Error: array_unshift() expects parameter 1 to be array, object given
any ideas?
Description of the method of how to wrap?
How to use the markdown title #?
Not to do it
/**
*### 通用登录
*#### 参数:
*/
according to @cebe
The page in question: http://www.yiiframework.com/doc-2.0/guide-tutorial-advanced-app.html
Try to open any link with anchor to a method/property and you'll find, that the page scrolls to the anchor, but the navigation bar is fixed and overlaps the beginning of the documentation block:
http://www.yiiframework.com/doc-2.0/yii-base-event.html#off()-detail
Since a few days i get the following error:
Error: Undefined property: stdClass::$methods
when running (has not changed since):
./vendor/bin/apidoc api [comma seperated list of all folders to lookup] /output/folder/ --pageTitle="TITLE" --interactive=0
Full process:
Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
137 files to update.
Processing files... done.
Updating cross references and backlinks... Error: Undefined property: stdClass::$methods
any idea?
This issue has originally been reported by @softark at yiisoft/yii2#8335.
Moved here by @cebe.
In #8168, a link (db-dao.md#database-schema)
has been modified as (db-dao.md#working-with-database-schema-)
. IMO, it should be reverted, since the intended anchor name in db-dao.md is 'database-schema'.
But it seems that the modification has been made based on the fact that the anchors are not rendered as intended in the github pages.
For example, this is what we have in http://www.yiiframework.com/doc-2.0/guide-db-dao.html
<h2>
Working with Database Schema
<span id="database-schema"></span>
<a href="#working-with-database-schema"
id="working-with-database-schema"
class="hashlink">¶</a>
</h2>
<p>Yii DAO provides ...
But the counterpart of it in https://github.com/yiisoft/yii2/blob/master/docs/guide/db-dao.md is:
<h2>
<a id="user-content-working-with-database-schema-"
class="anchor"
href="#working-with-database-schema-"
aria-hidden="true">
<span class="octicon octicon-link"></span>
</a>
Working with Database Schema
</h2>
<p>Yii DAO provides ...
(Note that I've reformatted the htmls for the sake of readability)
As you see, <span id="database-schema"></span>
is lost in the github version. And the auto created elements are different from each other.
As far as I understand, the policy in the Yii documentation is to use <span id="anchor-name"></span>
for an anchor. And I do favor it, because it is easy to refer to from other places of the documentation.
Especially, the auto created anchors based on the heading's text could be a nightmare for multi-byte languages: they will be URL-encoded. For example, https://github.com/yiisoft/yii2/blob/master/docs/guide-ja/db-dao.md goes like the following:
<h2>
<a id="user-content-データベーススキーマを扱う-"
class="anchor"
href="#%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%82%B9%E3%82%AD%E3%83%BC%E3%83%9E%E3%82%92%E6%89%B1%E3%81%86-"
aria-hidden="true">
<span class="octicon octicon-link"></span>
</a>
データベーススキーマを扱う
</h2>
<p>Yii DAO は、...
It will be very hard for us to use and maintain such an anchor in the documentation source text.
Although the fact is that the anchors in the span
tags are not rendered as intended in the github pages, and I think that we have to deal with the following problems:
$ vendor/bin/apidoc api vendor/yiisoft/yii2 out
Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
331 files to update.
Processing files... 0% (0/331) ETA: n/a PHP Fatal error: Interface 'PHPParser_NodeVisitor' not found in /Library/WebServer/Documents/yii2doc/vendor/phpdocumentor/reflection/src/phpDocumentor/Reflection/FileReflector.php on line 51
Error: Interface 'PHPParser_NodeVisitor' not found
For example Model::loadMultiple() or BaseYii::$app.
The information that the method is static is important to the developer.
I like the way the PHP manual does it, with the static
keyword in the signature, for example DateTime::getLastErrors
public static array DateTime::getLastErrors ( void )
For example:
class {
public static function cacheGetTime() : int
{
return 3600;
}
}
And that file is no apidoc generation. Problem in ": int" because without him all work
Hi @cebe,
following your commit 13ba053 I was checking how it was rendered now, but it looks like the file api.css
is not included in the building process (https://github.com/yiisoft/yii2-apidoc/blob/master/templates/bootstrap/assets/AssetBundle.php#L22).
Is that deliberate? If so, would be better to move the CSS rule in style.css
?
If I understand the rationale I'm more than happy to help out a bit with some code :)
For example, ActiveQueryInterface
extends QueryInterface
, but its documentation does not mention this (in the table at the top), and it does not list the inherited methods.
This issue has originally been reported by @hiqsol at yiisoft/yii2#10369.
Moved here by @cebe.
That's what we see in docs:
public static boolean createDirectory ( $path, $mode = 509, $recursive = true )
And in the source:
public static function createDirectory($path, $mode = 0775, $recursive = true)
Any interest/work in updating nikic/php-parser to 1.0+? I'll work on doing it if no one is and it is desired.
Here is the info on the upgrade: https://github.com/nikic/PHP-Parser/blob/1.x/UPGRADE-1.0.md
This issue has originally been reported by @davidsonalencar at yiisoft/yii2#6973.
Moved here by @cebe.
I ran the following command to export the pt-BR guide in PDF.
extensions/apidoc/apidoc guide docs/guide-pt-BR ./output
cd ./output
make pdf
When I analyzed the PDF content, I realized that the comments with special characters in code blocks were broken.
Is there some setting I can apply or is even an error?
This issue has originally been reported by @timfayz at yiisoft/yii2#2503.
Moved here by @cebe.
Hello, I can't access to message
property of exception's object. Is in normal?
My simple code:
#SiteController.php
#I changed errorHandler action to site/error in configurations.
public function actionError()
{
$this->layout = 'container';
if (\Yii::$app->exception !== null) {
return $this->render('error', ['exception' => \Yii::$app->exception]);
}
}
public function actionPage($view = 'index')
{
try {
return $this->render('site/page/'.$view);
} catch (InvalidParamException $e) {
throw new HttpException(404, 'Страница не найдена');
}
}
When I go to nonexist page, I get the following:
yii\web\HttpException Object
(
[statusCode] => 404
[message:protected] => Страница не найдена #custom message naturally inaccessible
It means that I can't insert $exception->message
into view file.
This issue has originally been reported by @mdmunir at yiisoft/yii2#5612.
Moved here by @cebe.
How to create api documentation only for my extension (without yii core) but related with yii2 apidoc (class refence)? Good point if can related with http://www.yiiframework.com/doc-2.0/
.
When executed like this
./bin/apidoc api mdmsoft/yii2-admin ../admin-apidoc
it will provide error message (errors.txt) "Method ini has no parent to inherit from in mdm\admin\Module".
When executed
./bin/apidoc api mdmsoft/yii2-admin,yiisoft/yii2 ../admin-apidoc
it will generate both of them and index file only list yii2 classes (no mdmsoft classes on index.html)
When the ```php
code block contains HTML, the Hightlight.php library renders it badly:
http://www.yiiframework.com/doc-2.0/guide-input-forms.html
http://www.yiiframework.com/doc-2.0/guide-start-forms.html#creating-views
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.