Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use md images #1

Merged
merged 5 commits into from
May 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lalrpop-docgen/src/railroad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ impl LalrpopToRailroad {
);

let diagram_ref = format!(
r#"<img src="{}svg/{}.svg" alt="{}" width="{}" height="{}"/>"#,
"![{}svg/{}.svg]({})",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the original choice, but not all rendering engines will use the width/height information in the svg to render the images correctly - and this makes the resulting documents visually sub optimal visually. We could add a flag to switch this behaviour for specific rendering engines though with this as a generic default

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes neither choices are right, some eingines will trip up with one, others with the other. This PR works with the engine we are using right now, while the current code causes problems. The .svg images do include the correct dimensions, so the forced with/height is mostly working around bugs in other engines. It feels odd to bias for bugs in engines we don't use and causing issues with the engine we use in return.

self.session.railroad_prefix,
name.to_ascii_lowercase(),
name,
Expand Down