lib: Add SpanLinkTag::Unresolved variant

keep the tag for unresolved links, and allow distinguishing between
`[tag][tag with empty url]` and `[tag][non-existent tag]`.

closes #26
This commit is contained in:
Noah Hellman 2023-03-19 13:12:16 +01:00
commit a603ea2124
4 changed files with 42 additions and 12 deletions

View file

@ -29,6 +29,7 @@ use crate::LinkType;
use crate::ListKind;
use crate::OrderedListNumbering::*;
use crate::Render;
use crate::SpanLinkType;
pub struct Renderer;
@ -163,7 +164,7 @@ impl<'s, I: Iterator<Item = Event<'s>>, W: std::fmt::Write> Writer<'s, I, W> {
Container::CodeBlock { .. } => self.out.write_str("<pre")?,
Container::Span | Container::Math { .. } => self.out.write_str("<span")?,
Container::Link(dst, ty) => {
if dst.is_empty() {
if matches!(ty, LinkType::Span(SpanLinkType::Unresolved)) {
self.out.write_str("<a")?;
} else {
self.out.write_str(r#"<a href=""#)?;