GithubHelp home page GithubHelp logo

playframework / play-doc Goto Github PK

View Code? Open in Web Editor NEW
20.0 12.0 23.0 469 KB

Play documentation rendering support

License: Apache License 2.0

Scala 87.71% Java 9.18% HTML 2.88% TeX 0.24%
playframework documentation sbt sbt-plugin scala

play-doc's Introduction

play-doc

Twitter Follow Discord GitHub Discussions StackOverflow YouTube Twitch Status OpenCollective

Build Status Maven Repository size Scala Steward badge Mergify Status

This project implements Plays documentation parsing and generating. Documentation is in markdown with an extension that allows code snippets to come from external files. It is used by Play to allow us to have all our documentation code snippets in external compiled and tested files, ensuring that they are accurate and up to date.

Markdown Syntax

Referencing code in an external file looks like this:

@[label](some/relative/path)

Code snippet syntax

Code snippets are identified using the hash symbol prepended to the label, like this:

//#label
println("Hello world")
//#label

The label can be anywhere in a line, and the code snippet will be every line between the start and end labels, exclusive. Typically the snippet might be part of a test, for example:

"List" should {
    "support fold" in {
    //#fold
    val list = List(1, 2, 3)
    val sum = list.fold { (a, b) => a + b }
    //#fold
    sum must_== 6
    }
}

In some rare cases, you may need to slightly modify the snippet as it stands. Typically this might be when naming conflicts exist in the code, for example, if you want to show an entire Java class with its package name, and you have multiple places in your docs where you want to do similar, you might do this:

//#label
//#replace package foo.bar;
package foo.bar.docs.sec1;

class Foo {
    ...
}
//#label

The supported directives are replace, skip (followed by the number of lines to skip) and insert.

Play Version

Any %PLAY_VERSION% variables will be substituted with the current version of Play.

Releasing a new version

See https://github.com/playframework/.github/blob/main/RELEASING.md

play-doc's People

Contributors

billyautrey avatar dotta avatar dwijnand avatar ennru avatar ignasi35 avatar ihostage avatar jroper avatar marcospereira avatar markusjura avatar mergify[bot] avatar mkurz avatar octonato avatar peutit avatar raboof avatar richdougherty avatar scala-steward avatar schmitch avatar wsargent avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-doc's Issues

Play doc should generate warnings in log when references are not found

Currently in the code, if you make a reference to form-myfield in ScalaFormHelpers.md and that label does not exist within user.scala.html, you will see text in the page saying "Unable to find label form-myfield in source file code/scalaguide/forms/scalaformhelper/views/user.scala.html".

The document generation should write to a logger that will warn or error when invalid references are found.

Play doc should provide easy linking to Play API

Given a document which contains text in the format:

@[play.api.GlobalSettings]

play-doc should generate the Markdown equivalent of the link to scaladoc (or javadoc):

[`play.api.GlobalSettings`](api/scala/index.html#play.api.GlobalSettings)

This may be awkward for singleton objects, which have the link ending in $, i.e. api/scala/index.html#play.api.DefaultGlobal$

So perhaps some specification could be used:

@[play.api.DefaultGlobal](singleton)

Or we could just specify it as the anchor tag directly:

@[play.api.DefaultGlobal$]

publish for Scala 2.13.0-M5?

in the 2.13.x community build, I see:

[play-doc] [error] /home/jenkins/workspace/scala-2.13.x-integrate-community-build/target-0.9.16/project-builds/play-doc-24e371958451b56240c8127317db6ab4627ad88f/src/main/scala/play/doc/PlayDoc.scala:245: polymorphic expression cannot be instantiated to expected type;
[play-doc] [error]  found   : [B]scala.collection.mutable.Buffer[B]
[play-doc] [error]  required: Seq[String]
[play-doc] [error]             }.flatten
[play-doc] [error]               ^
[play-doc] [error] /home/jenkins/workspace/scala-2.13.x-integrate-community-build/target-0.9.16/project-builds/play-doc-24e371958451b56240c8127317db6ab4627ad88f/src/main/scala/play/doc/PlayDoc.scala:245: polymorphic expression cannot be instantiated to expected type;
[play-doc] [error]  found   : [B]scala.collection.mutable.Buffer[B]
[play-doc] [error]  required: Seq[String]
[play-doc] [error]             }.flatten
[play-doc] [error]               ^

https://scala-ci.typesafe.com/view/scala-2.13.x/job/scala-2.13.x-integrate-community-build/1535/

Add carbon ads or some other non intrusive ads like other opensource websites as a source of revenue to support the project

Hi,

Just a humble suggestion, since now that the project is 100% maintained by our generous maintainers as per the announcement https://discuss.lightbend.com/t/on-the-future-of-play-framework/8920, perhaps as an additional source of income to support our maintainers - perhaps the project documentation can add ads banner, for example, the Carbon ads - like what other popular opensource project - e.g. Bootstrap, Vue are doing? I think it's reasonable for the banners to be there since they are pretty subtle and not intrusive.

image
https://vuejs.org/guide/introduction.html#what-is-vue

image
https://getbootstrap.com/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.