Closed sasja-san closed 10 months ago
I was making a work-around and found out that the spacing to the annotation number marker matters. Maybe this is intended?
I have yet to find a way to make the actual annotation (numbered list) to be able to go to the margin while still having the circled numbers.
---
format:
pdf:
documentclass: scrartcl
papersize: a4
geometry:
- showframe # Debugging purposes
- left=15.0mm
- textwidth=102.0mm
- marginparsep=7.7mm
- marginparwidth=70.3mm
code-annotations: true
code-block-bg: "#FFFFE8"
code-block-border-left: "#DDDDC8"
---
# Rust acting up *(as usual)*
lol might just do what (6) does, for all my numbers
::: {.column-margin}
1. The hardware 'dispatcher' whose interrupt will launch this function.
2. Global variable (a peripheral), only accessed from here.
3. Global variable, also accessed by others (thus "shared").
4. `cx` type is specific to this function. It has been generated through the RTIC macros.
5. Only way to access shared variable. Had this been many shared that needed simultaneous access then there would have been more arguments together with `tref`.
6. Launch the `main_task` isr, through software.
:::
```.rs
#[task(
binds = TIM4, // <1>
local = [ ms_timer ], // <2>
shared = [ current_tick ])] // <3>
fn milli_isr( // <4>
mut cx: milli_isr::Context) { // <4>
let u = TimerInterrupt::Update
cx.local.ms_timer.clear_interrupt(u);
cx.shared.current_tick.lock( // <5>
|tref| { *tref += 1; }); // <5>
let ev = Event::TickMillesec;
main_task::spawn(ev).ok(); // <6>
}
Can't get too close, though:
::: {.column-margin}
cx
type is specific to this function. It has been generated through the RTIC macros.tref
.Launch the main_task
isr, through software.
:::
#[task(
binds = TIM4, /* <1> */
local = [ ms_timer ], /* <2> */
shared = [ current_tick ])] /* <3> */
fn milli_irs( /* <4> */
mut cx: milli_isr::Context) {/* <4> */
let u = TimerInterrupt::Update
cx.local.ms_timer.clear_interrupt(u);
cx.shared.current_tick.lock( /* <5> */
|tref| { *tref += 1; }); /* <5> */
let ev = Event::TickMillesec;
main_task::spawn(ev).ok(); /* <6> */
}
\newpage
int main()
{
printf("Hello, World!\n"); /* <1> */
return 0; /* <2> */
}
I've open a PR to fix the rust portion this issue, here's an example doc:
---
title: Hello World
code-annotations: true
format: pdf
---
```rust
fn main() {
println!("Hello World!"); // <1>
return 0; // <2>
}
Code annotations aren't currently supported in the margins, though that is a great idea. Could you open a new issue to track adding support for that in a future release? We'll need to do some custom lifting to make that happen properly.
Did this really get fixed @dragonstyle? Try making a PDF out of this, remove the C code and then try again. At least I can't get it to work.
# C code
```c
int main(); /* <1> */
#[task(local = [led], priority = 4)] // <1>
fn blink(ctx: blink::Context)
{
let p = match ctx.local.led.get_state() // <2>
{
PinState::Low => (PinState::High),
PinState::High => (PinState::Low),
}
ctx.local.led.set_state(p);
blink::spawn_after(1.secs()).ok(); // <3>
}
#[task(binds = EXTI15_10, local = [btn])] // <4>
fn on_exti(ctx: on_exti::Context)
{
defmt::println!("Button (PC13) was pressed!");
ctx.local.btn.clear_interrupt_pending_bit(); // <5>
}
Yes:
---
title: Hello World
format: pdf
---
# C code
```c
int main(); /* <1> */
#[task(local = [led], priority = 4)] // <1>
fn blink(ctx: blink::Context)
{
let p = match ctx.local.led.get_state() // <2>
{
PinState::Low => (PinState::High),
PinState::High => (PinState::Low),
}
ctx.local.led.set_state(p);
blink::spawn_after(1.secs()).ok(); // <3>
}
#[task(binds = EXTI15_10, local = [btn])] // <4>
fn on_exti(ctx: on_exti::Context)
{
defmt::println!("Button (PC13) was pressed!");
ctx.local.btn.clear_interrupt_pending_bit(); // <5>
}
AHA! It has to be rust
and cannot be rs
.
So that I'm not as much of a burden going forward: How/where should I have gleamed this knowledge? Up until a minute ago (since I had a break and because I'm forgetfull) this was not a meaningful distinction.
I don't know that we have the list of languages documented anywhere, but you can use:
quarto pandoc --list-highlight-languages
This is mentioned here: https://quarto.org/docs/output-formats/html-code.html#highlighting
But is definitely pretty subtle. I wonder if it would be cool to add an article regarding code highlighting, code annotation, and other commonly needed cross format code options... (could include a table of Languages and their corresponding names in markdown)
(And you're not being a burden - I was just being sensitive because of course I fixed it [always true, except when it isn't ;-) ])
Haha, when annotation in the margin is added I'll do that write-up ;)
For now I'm happy with my cool h4xx to get around it. It definetly looks good enough.
I agree that looks amazing!
Bug description
$ quarto check Quarto 99.9.9 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 99.9.9 Path: /home/sasja/.quarto/quarto-cli/package/dist/bin
[✓] Checking tools....................OK TinyTeX: v2024.01 Chromium: 869685
[✓] Checking LaTeX....................OK Using: TinyTex Path: /home/sasja/.TinyTeX/bin/x86_64-linux Version: 2023
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.11.6 Path: /usr/bin/python3 Jupyter: 5.5.1 Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK Version: 4.3.2 Path: /usr/lib64/R LibPaths:
[✓] Checking Knitr engine render......OK