diff --git a/packages/preview/codly/1.3.1/.gitignore b/packages/preview/codly/1.3.1/.gitignore new file mode 100644 index 0000000000..77cfdcc281 --- /dev/null +++ b/packages/preview/codly/1.3.1/.gitignore @@ -0,0 +1,8 @@ +# added by typst-test +tests/*/out/** +tests/*/diff/** +test*.png +record-*.json +_*@bench/ +report/ +.DS_STORE \ No newline at end of file diff --git a/packages/preview/codly/1.3.1/LICENSE b/packages/preview/codly/1.3.1/LICENSE new file mode 100644 index 0000000000..f4687cbe64 --- /dev/null +++ b/packages/preview/codly/1.3.1/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2023] [Sébastien d'Herbais de Thun, et al.] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/preview/codly/1.3.1/README.md b/packages/preview/codly/1.3.1/README.md new file mode 100644 index 0000000000..cc8dc5234d --- /dev/null +++ b/packages/preview/codly/1.3.1/README.md @@ -0,0 +1,239 @@ +# Codly: simple yet beautiful and powerful code blocks + +

+ + Documentation + + + MIT License + + +

+ +Codly superchargescode blocks for your Typst documents. It allows you to add annotations, skip lines, customize numberings, add language icons, and much more. Codly is even better with its companion package [`codly-languages`](https://typst.app/universe/package/codly-languages) which provides a wide range of language icons and colors to choose from. + +A full set of documentation can be found [in the repo](https://raw.githubusercontent.com/Dherse/codly/main/docs.pdf). + +![Example](./assets/demo.png) + +````typ +#import "@preview/codly:1.3.1": * +#import "@preview/codly-languages:0.1.1": * +#show: codly-init.with() + +#codly(languages: codly-languages) +```rust +pub fn main() { + println!("Hello, world!"); +} +``` +```` + +### Setup + +To start using codly, you need to initialize codly using a show rule, this need only be done once per document: + +```typ +#show: codly-init.with() +``` + +Then you *can* configure codly with your parameters: + +```typ +#codly( + languages: ( + rust: (name: "Rust", icon: "🦀", color: rgb("#CE412B")), + ) +) +``` + +--- +**Note**: Any parameter that you leave blank will use the previous values (or the default value if never set) similar to a `set` rule in regular typst. But the changes are always global unless you use the provided `codly.local` function. To get a full list of all settings, see the [documentation](https://raw.githubusercontent.com/Dherse/codly/main/docs.pdf). + +--- + +Then you just need to add a code block and it will be automatically displayed correctly: + +```` +```rust +pub fn main() { + println!("Hello, world!"); +} +``` +```` + +![Crab](./assets/crab.png) + +### Disabling & Enabling + +To locally disable codly, you can just do the following, you can then later re-enable it using the `codly` configuration function. + +```typ +#codly-disable() +``` + +![codly-disable](./assets/codly-disable.png) + +Alternatively, you can use the `no-codly` function to achieve the same effect locally: + +````typ +#no-codly[ + ```typ + I will be displayed using the normal raw blocks. + ``` +] +```` + +### Smart indentation + +By default Codly ships with `smart-indent` enabled, this means that Codly will automatically detect the indentation of your code block and adjust the horizontal offset on line wrapping accordingly. This can be disabled using the `smart-indent` parameter. + +```typ +#codly(smart-indent: false) +``` + +![smart-ident](./assets/smart-indent.png) + +### Referencing code blocks + +Codly offers a wide range of features for referencing code blocks, lines, highlights, and annotations. This is done using: +- the line shorthand `@