mirror of
https://github.com/tommilligan/mdbook-admonish.git
synced 2025-12-27 13:30:47 -05:00
Compare commits
19 Commits
upgrade-de
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea6c0a687a | ||
|
|
50b9187ee5 | ||
|
|
fbd07ecaf0 | ||
|
|
37d03b872e | ||
|
|
fa91fe3778 | ||
|
|
d59dce3533 | ||
|
|
21d86546ff | ||
|
|
79ee592f56 | ||
|
|
0d3eb11a2c | ||
|
|
43579f902b | ||
|
|
7ee3643dc3 | ||
|
|
c4bf2608e7 | ||
|
|
d4667a5f55 | ||
|
|
8751b3cd24 | ||
|
|
516bbc6e7e | ||
|
|
fc5c5eae39 | ||
|
|
147a9bdb98 | ||
|
|
540ea8e5e8 | ||
|
|
ae4bac21ba |
16
.github/workflows/check.yml
vendored
16
.github/workflows/check.yml
vendored
@@ -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 }}
|
||||
|
||||
12
.github/workflows/deploy.yml
vendored
12
.github/workflows/deploy.yml
vendored
@@ -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
|
||||
|
||||
4
.github/workflows/docs.yml
vendored
4
.github/workflows/docs.yml
vendored
@@ -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
|
||||
|
||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,5 +1,33 @@
|
||||
# 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
|
||||
|
||||
- Add ARIA attributes to generated blocks. Thanks to [@toastal](https://github.com/toastal) for suggesting this feature! ([#195](https://github.com/tommilligan/mdbook-admonish/pull/195))
|
||||
- Note: This subtly alters the emitted HTML, and could cause additional styles applied to blocks to break. Native `mdbook-admonish` styles are not affected.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed some valid configurations producing TOML serialization errors. Thanks to [@DianaNites](https://github.com/DianaNites) for reporting this! ([#197](https://github.com/tommilligan/mdbook-admonish/pull/197))
|
||||
|
||||
## v1.17.1
|
||||
|
||||
### Fixed
|
||||
|
||||
1512
Cargo.lock
generated
1512
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "mdbook-admonish"
|
||||
version = "1.17.1"
|
||||
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"] }
|
||||
|
||||
@@ -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" }
|
||||
|
||||
2
compile_assets/.gitignore
vendored
2
compile_assets/.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
/node_modules
|
||||
*.css
|
||||
*.css.map
|
||||
.yarn/
|
||||
.pnp*
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@4.8.1+sha512.bc946f2a022d7a1a38adfc15b36a66a3807a67629789496c3714dd1703d2e6c6b1c69ff9ec3b43141ac7a1dd853b7685638eb0074300386a59c18df351ef8ff6"
|
||||
}
|
||||
|
||||
@@ -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
@@ -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]]
|
||||
|
||||
@@ -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]]
|
||||
|
||||
@@ -47,17 +47,17 @@
|
||||
</div>
|
||||
<div>
|
||||
<p>Failed with:</p>
|
||||
<pre><code class="language-log">'title="' 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=" }
|
||||
1 | config = { title=" }
|
||||
| ^
|
||||
invalid basic string
|
||||
|
||||
</code></pre>
|
||||
<p>Original markdown input:</p>
|
||||
<pre><code class="language-markdown">```admonish title="
|
||||
<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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0.2
|
||||
3.1.0
|
||||
|
||||
@@ -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>");
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}>"#,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user