Compare commits

...

16 Commits

Author SHA1 Message Date
Tom Milligan
ea6c0a687a Merge pull request #229 from tommilligan/prep-1.20.0
chore: prep v1.20.0 release
2025-06-06 14:53:02 +01:00
Tom Milligan
50b9187ee5 chore: prep v1.20.0 release 2025-06-06 14:35:51 +01:00
Tom Milligan
fbd07ecaf0 Merge pull request #228 from tommilligan/print-collapsed-details
feat: show collapsed content in print view
2025-06-06 14:21:49 +01:00
Tom Milligan
37d03b872e feat: show collapsed content in print view 2025-06-06 12:58:11 +01:00
Tom Milligan
fa91fe3778 Merge pull request #227 from tommilligan/update-deps-2025-06
chore: update dependencies
2025-06-06 12:37:47 +01:00
Tom Milligan
d59dce3533 chore: update dependencies 2025-06-06 12:34:38 +01:00
Tom Milligan
21d86546ff Merge pull request #224 from tommilligan/fix-nested-list-content-indent
fix: do not double indent content in lists
2025-02-17 15:55:07 +00:00
Tom Milligan
79ee592f56 chore: prep v1.19.0 release 2025-02-17 15:42:27 +00:00
Tom Milligan
0d3eb11a2c fix: do not double indent content in lists 2025-02-17 15:38:33 +00:00
CoralPink
43579f902b Hide extra markers displayed in Safari. (#185)
* Hide extra markers displayed in `Safari`.

* [review] move webkit fix

---------

Co-authored-by: Tom Milligan <tom.milligan@uipath.com>
2024-08-17 06:19:01 +01:00
Tom Milligan
7ee3643dc3 Merge pull request #209 from tommilligan/deps-upgrade-2
chore: relax action constraints
2024-08-16 08:54:37 +01:00
Tom Milligan
c4bf2608e7 chore: relax action constraints 2024-08-16 08:50:25 +01:00
Tom Milligan
d4667a5f55 Merge pull request #208 from tommilligan/deps-upgrade
chore: upgrade rust, deps and actions
2024-08-16 08:39:23 +01:00
Tom Milligan
8751b3cd24 chore: upgrade github actions 2024-08-16 07:56:14 +01:00
Tom Milligan
516bbc6e7e chore: update rust lockfile 2024-08-16 07:48:11 +01:00
Tom Milligan
fc5c5eae39 chore: bump msrvc to 1.76.0 2024-08-16 07:46:50 +01:00
20 changed files with 2166 additions and 683 deletions

View File

@@ -6,7 +6,7 @@ jobs:
# Fast test before we kick off all the other jobs
fast-test:
name: Fast test
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
@@ -31,7 +31,7 @@ jobs:
detailed-test:
needs: fast-test
name: Test main target
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
@@ -50,8 +50,10 @@ jobs:
with:
toolchain: stable
components: rustfmt, clippy
- name: Enable Corepack
run: corepack enable
- name: Install node toolchain
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
@@ -70,16 +72,16 @@ jobs:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-24.04
rust:
- stable
- beta
- 1.74.0
- 1.82.0
experimental:
- false
include:
# Run a canary test on nightly that's allowed to fail
- os: ubuntu-20.04
- os: ubuntu-24.04
rust: nightly
experimental: true
# Test only stable on Windows, presume we'd get same result on other
@@ -89,7 +91,7 @@ jobs:
experimental: false
exclude:
# Don't bother retesting stable linux, we did it in the comprehensive test
- os: ubuntu-20.04
- os: ubuntu-24.04
rust: stable
experimental: false
runs-on: ${{ matrix.os }}

View File

@@ -25,7 +25,7 @@ jobs:
# binaries, so we use the same glibc version
#
# ref: https://github.com/rust-lang/mdBook/pull/1955
os: ubuntu-20.04
os: ubuntu-24.04
name: x86_64-unknown-linux-gnu.tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
@@ -92,10 +92,12 @@ jobs:
tar czvf ../../stage/${{ env.CRATE_NAME }}-${{ steps.extract_tag.outputs.tag }}-${{ matrix.name }} ${{ env.CRATE_NAME }}
cd -
- name: Post Setup | Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.CRATE_NAME }}-${{ steps.extract_tag.outputs.tag }}-${{ matrix.name }}
path: target/stage/*
# Idempotency: overwrite artefact by name if we're rerunning the deployment
overwrite: true
# Create GitHub release with Rust build targets and release notes
github_release:
@@ -109,7 +111,7 @@ jobs:
fetch-depth: 0
- name: Setup | Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Setup | Extract version
shell: bash
@@ -120,7 +122,7 @@ jobs:
run: |
cat CHANGELOG.md | sed -n '/^## ${{ steps.extract_version.outputs.version }}$/,/^## /p' | sed '$d' > RELEASE.md
- name: Build | Publish
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: ${{ env.CRATE_NAME }}-*/${{ env.CRATE_NAME }}-*
body_path: RELEASE.md
@@ -131,7 +133,7 @@ jobs:
publish:
name: Publish to crates.io
needs: github_release
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4

View File

@@ -11,7 +11,7 @@ permissions:
jobs:
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
@@ -39,7 +39,7 @@ jobs:
- name: Build book
run: ./scripts/build-book
- name: Push docs
uses: JamesIves/github-pages-deploy-action@v4.4.3
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: book/book

View File

@@ -1,5 +1,22 @@
# Changelog
## v1.20.0
### Changed
- MSRV (minimum supported rust version) is now 1.82.0 ([#227](https://github.com/tommilligan/mdbook-admonish/pull/227))
- Collapsible blocks now show content in print view ([#228](https://github.com/tommilligan/mdbook-admonish/pull/228)). Thanks to [@igor-petruk](https://github.com/igor-petruk) for raising this issue.
## v1.19.0
### Changed
- MSRV (minimum supported rust version) is now 1.76.0 ([#208](https://github.com/tommilligan/mdbook-admonish/pull/208))
### Fixed
- Fixed blocks not rendering correctly in indented list items. Thanks to [@JorelAli](https://github.com/JorelAli) for the bug report! ([#224](https://github.com/tommilligan/mdbook-admonish/pull/224))
## v1.18.0
### Changed

1512
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
[package]
name = "mdbook-admonish"
version = "1.18.0"
version = "1.20.0"
edition = "2021"
rust-version = "1.74.0"
rust-version = "1.76.0"
authors = ["Tom Milligan <code@tommilligan.net>"]
description = "A preprocessor for mdbook to add Material Design admonishments."
@@ -36,7 +36,7 @@ log = "0.4.21"
mdbook = "0.4.40"
once_cell = "1.19.0"
path-slash = "0.2.1"
pulldown-cmark = "0.11"
pulldown-cmark = "0.13"
regex = "1.10.5"
semver = "1.0.23"
serde = { version = "1.0.203", features = ["derive"] }

View File

@@ -10,7 +10,7 @@ git-repository-url = "https://github.com/tommilligan/mdbook-admonish"
[preprocessor.admonish]
command = "mdbook-admonish"
assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`
assets_version = "3.1.0" # do not edit: managed by `mdbook-admonish install`
[preprocessor.admonish.directive.custom]
expensive = { icon = "./money-bag.svg", color = "#24ab38" }

View File

@@ -1,3 +1,5 @@
/node_modules
*.css
*.css.map
.yarn/
.pnp*

View File

@@ -15,5 +15,6 @@
},
"devDependencies": {
"prettier": "^3.0.3"
}
},
"packageManager": "yarn@4.8.1+sha512.bc946f2a022d7a1a38adfc15b36a66a3807a67629789496c3714dd1703d2e6c6b1c69ff9ec3b43141ac7a1dd853b7685638eb0074300386a59c18df351ef8ff6"
}

View File

@@ -92,8 +92,9 @@ $admonitions: (
0 0.2rem 1rem rgba(0, 0, 0, 0.05),
0 0 0.1rem rgba(0, 0, 0, 0.1);
// [print]: Omit shadow as it may lead to rendering errors
// During print mode in browser, pdf renderer
@media print {
// Omit shadow as it may lead to rendering errors
box-shadow: none;
}
@@ -200,6 +201,14 @@ a.admonition-anchor-link {
}
}
// During print mode in browser, pdf renderer
@media print {
// Expand collapsed sections to show details
details.admonition::details-content {
display: contents;
}
}
summary.admonition-title {
details.admonition > &::after {
position: absolute;
@@ -222,6 +231,12 @@ summary.admonition-title {
details[open].admonition > &::after {
transform: rotate(90deg);
}
// Hide details marker for Safari that loves to show it anyway
// ref: https://github.com/tommilligan/mdbook-admonish/pull/185
&::-webkit-details-marker {
display: none;
}
}
:root {

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@ title = "mdbook-admonish-integration"
[preprocessor.admonish]
command = "mdbook-admonish"
assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`
assets_version = "3.1.0" # do not edit: managed by `mdbook-admonish install`
after = ["links"]
[[preprocessor.admonish.custom]]

View File

@@ -9,7 +9,7 @@ title = "mdbook-admonish-integration"
[preprocessor.admonish]
command = "mdbook-admonish"
assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`
assets_version = "3.1.0" # do not edit: managed by `mdbook-admonish install`
after = ["links"]
[[preprocessor.admonish.custom]]

View File

@@ -47,17 +47,17 @@
</div>
<div>
<p>Failed with:</p>
<pre><code class="language-log">'title=&quot;' is not a valid directive or TOML key-value pair.
<pre><code class="language-log">'title="' is not a valid directive or TOML key-value pair.
TOML parsing error: TOML parse error at line 1, column 21
|
1 | config = { title=&quot; }
1 | config = { title=" }
| ^
invalid basic string
</code></pre>
<p>Original markdown input:</p>
<pre><code class="language-markdown">```admonish title=&quot;
<pre><code class="language-markdown">```admonish title="
No title, only body
```
</code></pre>
@@ -137,6 +137,23 @@ let x = 20;
<p>Thing two</p>
</div>
</div>
<ol>
<li>
<p>Thing two nested</p>
<div id="admonition-note-5" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-5-title">
<div class="admonition-title">
<div id="admonition-note-5-title">
<p>Note</p>
</div>
<a class="admonition-anchor-link" href="#admonition-note-5"></a>
</div>
<div>
<p>Thing two nested (should not be a code block)
Regression tests for https://github.com/tommilligan/mdbook-admonish/issues/223</p>
</div>
</div>
</li>
</ol>
</li>
<li>
<p>Thing three</p>

View File

@@ -60,6 +60,13 @@ In a list:
Thing two
```
1. Thing two nested
```admonish
Thing two nested (should not be a code block)
Regression tests for https://github.com/tommilligan/mdbook-admonish/issues/223
```
1. Thing three
```sh

View File

@@ -8,7 +8,7 @@ function eprintln() {
>&2 echo "$1"
}
VERSION="0.4.35"
VERSION="0.4.51"
eprintln "Checking if mdbook $VERSION is installed"
if [[ "$(mdbook --version)" != "mdbook v$VERSION" ]]; then

View File

@@ -1 +1 @@
3.0.2
3.1.0

View File

@@ -86,6 +86,11 @@ html :is(.admonition-title, summary.admonition-title):last-child {
display: initial;
}
@media print {
details.admonition::details-content {
display: contents;
}
}
details.admonition > summary.admonition-title::after {
position: absolute;
top: 0.625em;
@@ -106,6 +111,9 @@ details.admonition > summary.admonition-title::after {
details[open].admonition > summary.admonition-title::after {
transform: rotate(90deg);
}
summary.admonition-title::-webkit-details-marker {
display: none;
}
:root {
--md-details-icon: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42Z'/></svg>");

View File

@@ -1153,9 +1153,9 @@ Text
<a class="admonition-anchor-link" href="#admonition-note"></a>
</div>
<div>
Thing two
Thing two
</div>
</div>
@@ -1168,4 +1168,97 @@ Text
assert_eq!(expected, prep(content));
}
// Regression test for https://github.com/tommilligan/mdbook-admonish/issues/223
#[test]
fn nested_list_should_not_render_indented_code_block() {
let content = r#"# Chapter
- Level one
```admonish
Thing one
line two
```
- Level two
```admonish
Thing two
line two
```
- Level three
```admonish
Thing three
line two
```
"#;
let expected = r##"# Chapter
- Level one
<div id="admonition-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-title">
<div class="admonition-title">
<div id="admonition-note-title">
Note
</div>
<a class="admonition-anchor-link" href="#admonition-note"></a>
</div>
<div>
Thing one
line two
</div>
</div>
- Level two
<div id="admonition-note-1" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-1-title">
<div class="admonition-title">
<div id="admonition-note-1-title">
Note
</div>
<a class="admonition-anchor-link" href="#admonition-note-1"></a>
</div>
<div>
Thing two
line two
</div>
</div>
- Level three
<div id="admonition-note-2" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-2-title">
<div class="admonition-title">
<div id="admonition-note-2-title">
Note
</div>
<a class="admonition-anchor-link" href="#admonition-note-2"></a>
</div>
<div>
Thing three
line two
</div>
</div>
"##;
assert_eq!(expected, prep(content));
}
}

View File

@@ -97,13 +97,15 @@ impl<'a> Admonition<'a> {
// - the additional whitespace around the content are deliberate
// In line with the commonmark spec, this allows the inner content to be
// rendered as markdown paragraphs.
// - We should not indent the inner content, as it retains the indent
// it is written with.
format!(
r#"
{indent}<{admonition_element} {attributes}>
{titlebar_html}{indent}<div>
{indent}
{indent}{content}
{indent}
{content}
{indent}</div>
{indent}</{admonition_element}>"#,
)