-
Notifications
You must be signed in to change notification settings - Fork 81
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
Target a single file for --in
and --out
#322
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c957fe2
add in the ability for --in to handle a single file
ckipp01 5a5111c
add in documenation for targeting an individual file
ckipp01 264ee02
add ability to specify an out file
ckipp01 20e71df
Support multiple input/output file/directory pairs.
1150de9
Add more tests and docs
6ba97f7
Address review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,6 @@ The sbt-mdoc plugin supports the following settings. | |
|
||
``` | ||
|
||
|
||
## Command-line | ||
|
||
Use [coursier](https://github.com/coursier/coursier/#command-line) to launch | ||
|
@@ -135,6 +134,8 @@ info: Compiling 1 file to website/target/docs | |
info: Compiled in 1.2s (0 errors) | ||
``` | ||
|
||
### Add library dependencies to classpath | ||
|
||
Add libraries to the launched classpath to include them for compilation. | ||
|
||
```diff | ||
|
@@ -143,14 +144,28 @@ Add libraries to the launched classpath to include them for compilation. | |
+ org.typelevel:cats-core_@SCALA_BINARY_VERSION@:1.5.0 | ||
``` | ||
|
||
Use `--in` to customize the input directory where markdown sources are | ||
contained, by default the `docs/` directory is used. | ||
### Customize input directory | ||
|
||
By default the `docs/` directory is processed as input. Use `--in` to customize | ||
the input directory where markdown sources are contained, | ||
|
||
```diff | ||
coursier launch org.scalameta:mdoc_@SCALA_BINARY_VERSION@:@VERSION@ -- \ | ||
+ --in mydocs | ||
``` | ||
|
||
### Process single markdown file | ||
|
||
The `--in` flag doesn't have to be a directory, it also supports individual | ||
files. | ||
|
||
```diff | ||
coursier launch org.scalameta:mdoc_@SCALA_BINARY_VERSION@:@VERSION@ -- \ | ||
+ --in mydocs/readme.md | ||
``` | ||
|
||
### Configure site variables like `@@VERSION@` | ||
|
||
Use `--site.VARIABLE=value` to add site variables that can be referenced from | ||
markdown as `@@VARIABLE@`. | ||
|
||
|
@@ -159,14 +174,44 @@ markdown as `@@VARIABLE@`. | |
+ --site.SCALA_VERSION @SCALA_VERSION@ | ||
``` | ||
|
||
Use `--out` to customize the directory where markdown sources are generated, by | ||
default the `out/` directory is used. | ||
### Customize output directory | ||
|
||
Use `--out` to customize where your markdown sources are generated, by default | ||
the `out/` directory is used. | ||
|
||
```diff | ||
coursier launch org.scalameta:mdoc_@SCALA_BINARY_VERSION@:@VERSION@ -- \ | ||
+ --out target/docs | ||
``` | ||
|
||
### Generate single output file instead of directory | ||
|
||
The `--out` flag doesn't have to be a directory when the `--in` argument is a | ||
regular file, it can also be an individual file. | ||
|
||
```diff | ||
coursier launch org.scalameta:mdoc_@SCALA_BINARY_VERSION@:@VERSION@ -- \ | ||
+ --in readme.template.md \ | ||
+ --out readme.md | ||
``` | ||
|
||
### Process multiple input directories and files | ||
|
||
Repeat the `--in` and `--out` arguments to process multiple directories and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
regular files. | ||
|
||
```diff | ||
coursier launch org.scalameta:mdoc_@SCALA_BINARY_VERSION@:@VERSION@ -- \ | ||
+ --in readme.template.md \ | ||
+ --out readme.md \ | ||
+ --in changelog.template.md \ | ||
+ --out changelog.md \ | ||
+ --in mydocs-directory \ | ||
+ --out out-directory \ | ||
``` | ||
|
||
### Live reload HTML preview on file save | ||
|
||
Use `--watch` to start the file watcher with livereload. It's recommended to use | ||
`--watch` while writing documentation to enjoy 3-4x faster compilation | ||
performance. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,5 +39,5 @@ class SbtModifier extends StringModifier { | |
</tr> | ||
{rows} | ||
</table> | ||
}.toString() | ||
}.toString() + "\n\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package mdoc | ||
|
||
import mdoc.internal.cli.Settings | ||
|
||
final class OnLoadContext private[mdoc] ( | ||
val reporter: Reporter, | ||
private[mdoc] val settings: Settings | ||
) { | ||
def site: Map[String, String] = settings.site | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package mdoc | ||
|
||
import scala.meta.io.AbsolutePath | ||
import scala.meta.io.RelativePath | ||
import mdoc.internal.cli.Settings | ||
import mdoc.internal.cli.InputFile | ||
|
||
final class PostProcessContext private[mdoc] ( | ||
val reporter: Reporter, | ||
private[mdoc] val file: InputFile, | ||
private[mdoc] val settings: Settings | ||
) { | ||
def relativePath: RelativePath = file.relpath | ||
def inputFile: AbsolutePath = file.inputFile | ||
def outputFile: AbsolutePath = file.outputFile | ||
def inDirectory: AbsolutePath = file.inputDirectory | ||
def outDirectory: AbsolutePath = file.outputDirectory | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL'd about turbo 🤔