Try to imagine getting your day job done after several of your colleagues were killed at your office.

It is hard to fathom. But that's exactly what staffers at the Capital Gazette newspaper company did.

The surviving staff members rallied together to publish Friday's edition of The Capital, just hours after a gunman shot his way inside the paper's office in Annapolis, Maryland.

The front page headline: "5 shot dead at The Capital."

The lead story had 10 bylines, reflecting a team effort by the relatively small community newspaper.

Editor Rick Hutzell was quoted: "We are heartbroken, devastated. Our colleagues and friends are gone."

"No matter how deep," he added, "our loss is nothing compared to the grief our friends' families are feeling."

Four of the dead -- Rob Hiaasen, Gerald Fischman, Wendi Winters and John McNamara -- were veteran editors and reporters. The fifth victim, Rebecca Smith, was an ad sales assistant for the paper. Local law enforcement said the newspaper as a whole was "targeted."

The paper devoted its opinion page to the memory of the victims.

"This page is intentionally left blank today to commemorate victims of Thursday's shootings at our office," the text read. "Tomorrow this page will return to its steady purpose of offering our readers informed opinions about the world around them, that they might be better citizens."

The resolve of the surviving staffers was inspiring on a tragic day in Annapolis.

The Capital and the Maryland Gazette are both published by the Baltimore Sun Media Group, a unit of Tronc. Some Sun staffers helped with Friday's edition as well.

Trif Alatzas, the publisher of the Baltimore Sun Media Group, said in a memo that "no words can adequately express our sadness" about the loss of life.

In addition to the five fatalities, two other newspaper staffers were taken to the hospital "with non life-threatening injuries," and have since been released, according to Alatzas.

Soon after the shooting, employees started making plans for Friday's edition. It was not immediately clear where the staffers were working from. Capital Gazette reporter Phil Davis said earlier in the day that the newsroom looked "like a war zone" after the shooting. But in this day and age, newspaper production can be done remotely.

"I can tell you this: We are putting out a damn paper tomorrow," reporter Chase Cook tweeted.

Related: Annapolis attack: Deadliest day for journalism in US since 9/11

Cook's defiant tweet was picked up and cheered by thousands of journalists and well-wishers.

Erin Cox, the Sun's state house bureau chief, retweeted Cook and said, "You have to admire the attitude of The Capital reporters writing the story of a massacre in their own newsroom."

There was an outpouring from journalists -- both from rival Maryland newsrooms and from others across the country -- offering to help.

"Our hearts go out to the victims and their family, friends and colleagues. We are ready to help in any way we can," Society of Professional Journalists national president Rebecca Baker said in a statement.

Some supporters have encouraged people to subscribe to the paper as an act of solidarity.

On Friday's front page, the faces of the five slain staffers appeared at the top, above the main headline and the story.

The main story mentioned the gunman, but it was largely a tribute to the staffers. Two pages inside the paper contained obituaries, ensuring that the spotlight wouldn't just be on the killer, but on the lives that were taken on Thursday.